Subject: Re: DLL Linking Problem
From: "Niraj Agarwal" <[email-masked]>
To: "Gerrit P. Haase" <[email-masked]>
Cc: <[email-masked]>
Date: Tue, 27 Aug 2002 16:24:47 +0530

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" <[email-masked]>
To: "Niraj Agarwal" <[email-masked]>
Cc: <[email-masked]>
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
> -- 
> =^..^=