Subject: Re: DLL Linking Problem
From: "Gerrit P. Haase" <[email-masked]>
To: "Niraj Agarwal" <[email-masked]>
Cc: [email-masked]
Date: Tue, 27 Aug 2002 11:50:36 +0200

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

--
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/