This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: DLL calling a DLL: undefined reference when linking.

"Elfyn McBratney" <elfyn-cygwin at exposure dot org dot uk> wrote in message
news:031a01c2dadb$bf7b0a40$666d86d9 at webdev dot  dot  dot 
> >     I think I'm making marvelous progress.  Unfortunately, I'm getting
> > error that doesn't make sense:
> >
> > $g++ -shared -mno-cygwin -o dllhello.dll dllhello.o
> > other.dll -Wl,--out-implib,libdllhello.a -Wl,--enable-stdcall-fixup
> > Creating library file: libdllhello.a
> > dllhello.o(.text+0x164):dllhello.C: undefined reference to `InitAPI at 4'
> >
> > In my source code, the offending call is:
> >
> > extern "C" PASCAL void InitAPI( int handle );
> Does dllhello.c include a header containing the prototype of InitAPI or
> a declaration of InitAPI? I think that's the gotcha.
> Regards,
> Elfyn McBratney
> elfyn at exposure dot org dot uk

Both the extern prototype and the function call are in dllhello.C.  Thus it
does see the prototype.  As a further note and after further testing, if I
use implib on other.dll, I get the export list.  If I add an alias in the
.def file

InitAPI at 4
InitAPI=InitAPI at 4

then use dlltool to create the library, I can link against that library

So it seems clear that --enable-stdcall-fixup isn't working as advertised.

Any idea why?


Unsubscribe info:
Bug reporting:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]