[Gambas-user] Dificulty with Extern call when return struct variable

Benoit Minisini gambas at ...1...
Wed Jun 4 12:33:19 CEST 2008


On mardi 03 juin 2008, Wellington de Souza Pinto wrote:
> Hi Benoit!
>
> The missing message i solved with ldconfig. But not understand how return
> struct in Extern xxxx(zzz AS integer, ooo AS integer) AS yyyy IN "libpop3"
>
> I'm send my project with C program for you help me.
>
> ipConnect-0.0.1.tar.gz (gambas3 project)
> my problem is pop3.pop3GetEmail(...)
>
> libpop3-0.4.1.tar.gz      (C program)
>
> Best Reguards,
>
> Souza, Wellington
>

I don't really know what gcc does in that case. But if it returns a pointer to 
the structure, you have to use the READ instruction to read the structure 
fields by using their memory address, or the StrPtr() function, as there is 
no support for structures in Gambas yet.

DIM Result AS Pointer

Result = pop3.pop3GetEMail(...)

PRINT "To: "; StrPtr(Result)
PRINT "Cc: "; StrPtr(Result + 4)
PRINT "Bcc: "; StrPtr(Result + 8)
...

The weird thing is that you must write code that is 32 bits specific. I hope 
this problem will be solved in Gambas 3.

Regards,

-- 
Benoit Minisini




More information about the User mailing list