DLL Linking Problem
Gerrit P. Haase
freeweb@nyckelpiga.de
Tue Aug 27 02:50:00 GMT 2002
Niraj schrieb:
[dll problems with simple dll]
Your example is not simple, see this really simple example:
TestDll.c:
==========
#include <stdio.h>
void printVal()
{
printf("Hello World!");
}
TestDll.h:
==========
void printVal();
testmain.c:
===========
#include "TestDll.h"
int main()
{
printVal();
return 1;
}
$ gcc -c TestDll.c -o TestDll.o
$ gcc -shared -o cygTestDll.dll \
-Wl,--out-implib=libTestDll.dll.a \
-Wl,--export-all-symbols \
-Wl,--enable-auto-import \
-Wl,--whole-archive TestDll.o \
-Wl,--no-whole-archive
Creating library file: libTestDll.dll.a
$ gcc -o testmain testmain.c -L. -lTestDll
$ ./testmain
Hello World!
Gerrit
--
=^..^=
Attachment:
testmain.c
Description: Text document
Attachment:
TestDll.h
Description: Text document
Attachment:
TestDll.c
Description: Text document
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
More information about the Cygwin
mailing list