This is the mail archive of the cygwin@cygwin.com 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 Linking Problem


Hi Gerrit,

This is really simple. But problem is that i want to include the dll prepared using vc++ in program written in cygwin environment.

Please help me in this regard.

Niraj
----- Original Message ----- 
From: "Gerrit P. Haase" <freeweb@nyckelpiga.de>
To: "Niraj Agarwal" <niraja@npi.stpn.soft.net>
Cc: <cygwin@cygwin.com>
Sent: Tuesday, August 27, 2002 3:20 PM
Subject: Re: DLL Linking Problem


> 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
> -- 
> =^..^=

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