linking DLLs in Win32 w/ cygwin

Alexandre Jose Reis Santoro santoro@gavea.Stanford.EDU
Tue Dec 7 18:12:00 GMT 1999


I have an NT box with cygwin b20.1 installed and am trying to link a
program with an existing dll. Here's what I've done:

1) Use impdef to create the export file:
	% impdef foo.dll > foo.def

2) foo.def has the form:
	EXPORTS
	_A@xx
	_B@yy
	C
	_D@zz

3) Manually edit foo.def to make it look like:
	EXPORTS
	A@xx
	B@yy
	C
	D@zz

This is necessary otherwise I can't link my program, I get an
"undefined reference to imp__A@xx" instead.

4) Run dlltool to produce libfoo.a
	% dlltool --dllname foo.dll --def foo.def --output-lib libfoo.a -k

5) compile the program
	% gcc -L. -I. bar.c -lfoo -o bar

Everything compiles fine, but when I run I get the following error
message:

"The procedure entry point A could not be located in the dynamic link
library foo.dll"

I fear I'm missing some important step, but for the life of me can't
figure out what.

Any help solving this puzzle  would be appreciated.

- Alex Santoro (santoro@stanford.edu)




More information about the Gcc-help mailing list