| delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Date: | Tue, 27 Aug 2002 11:50:36 +0200 |
| From: | "Gerrit P. Haase" <freeweb AT nyckelpiga DOT de> |
| Reply-To: | "Gerrit P. Haase" <freeweb AT nyckelpiga DOT de> |
| Organization: | Esse keine toten Tiere |
| X-Priority: | 3 (Normal) |
| Message-ID: | <50-323541628.20020827115036@familiehaase.de> |
| To: | "Niraj Agarwal" <niraja AT npi DOT stpn DOT soft DOT net> |
| CC: | cygwin AT cygwin DOT com |
| Subject: | Re: DLL Linking Problem |
| In-Reply-To: | <001a01c24da3$35aec790$46ca09c0@aniraj> |
| References: | <001a01c24da3$35aec790$46ca09c0 AT aniraj> |
| MIME-Version: | 1.0 |
------------E3D88AC033D4A
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
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
--
=^..^=
------------E3D88AC033D4A
Content-Type: text/plain; name="testmain.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="testmain.c"
I2luY2x1ZGUgIlRlc3REbGwuaCIKaW50IG1haW4oKQp7CglwcmludFZhbCgpOwoJcmV0dXJuIDE7
Cn0KCg==
------------E3D88AC033D4A
Content-Type: text/plain; name="TestDll.h"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="TestDll.h"
dm9pZCBwcmludFZhbCgpOwo=
------------E3D88AC033D4A
Content-Type: text/plain; name="TestDll.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="TestDll.c"
I2luY2x1ZGUgPHN0ZGlvLmg+CnZvaWQgIHByaW50VmFsKCkKewoJcHJpbnRmKCJIZWxsbyBXb3Js
ZCEiKTsKfQo=
------------E3D88AC033D4A
Content-Type: text/plain; charset=us-ascii
--
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/
------------E3D88AC033D4A--
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |