cygwin DLLs and VC (again)
Manuel Sánchez
icg_incubus@yahoo.com
Tue Mar 21 10:01:00 GMT 2000
ÃÂ ÃÂ ÃÂ This message follows to the
one I posted on March 16.
ÃÂ ÃÂ ÃÂ Following the explanations Mumit Khan
kindly gave, I managed to link dinamically a cygwin GCC compiled DLL from a VC
compiled exe, and using __stdcall calling specifier, it worked fine with
ordinary C methods. One of the methods returned an object whose class derived
the ICommon interface... well, a correct instance was returned, but then I
noticed that there are some differences between VC and GCC when dealing with
method calling:
ÃÂ
ÃÂ ÃÂ ÃÂ First of
all: VC stores the object pointer in ecx before it calls the method itself, and
it seems that GCC do the same in ebx.
ÃÂ ÃÂ ÃÂ VC uses the eax register as
storage for the returning value... I think GCC uses the stack.
ÃÂ ÃÂ ÃÂ Virtual tables differ in
method pointer placement in VC and GCC: when calling to one method from VC using
a certain offset from the vtable it jumps to another method whose assembly it's
easily recognisable (the release method), but it'snt the one it was supossed to
call!!!
ÃÂ
ÃÂ ÃÂ ÃÂ So I wonder if is there any
way of forcing both compilers to work in the same way.
ÃÂ
ÃÂ ÃÂ ÃÂ Thanks
for reading this.
ÃÂ
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ Tony Sanchez
More information about the Cygwin
mailing list