delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/08/20/20:52:35

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: Wed, 21 Aug 2002 02:53:43 +0200
From: "Gerrit P. Haase" <gp AT familiehaase DOT de>
Reply-To: "Gerrit @ cygwin" <cygwin AT cygwin DOT com>
Organization: Esse keine toten Tiere
X-Priority: 3 (Normal)
Message-ID: <187380682792.20020821025343@familiehaase.de>
To: Lostmind <lostmind AT gmx DOT net>
CC: cygwin AT cygwin DOT com
Subject: Re: Problems exporting my DLL functions...
In-Reply-To: <3D62A993.AC202DD5@gmx.net>
References: <3D5F1721 DOT 2808F1A3 AT gmx DOT net>
<20020820035042 DOT B98873DC3 AT cavall DOT jtang DOT org> <3D5F33EC DOT 5F9A8D24 AT gmx DOT net>
<39336161164 DOT 20020820143142 AT familiehaase DOT de> <3D62A993 DOT AC202DD5 AT gmx DOT net>
MIME-Version: 1.0

Hallo Lostmind,

Am Dienstag, 20. August 2002 um 22:41 schriebst du:

>> gcc -o khook.o -c khook.o
>> gcc -shared -o mydll.dll khook.o

> Cool, it works, thanx :D

> ...at least it creates a DLL, but finally two things:

> 1. How do I tell the compiler/linker what is my DLL-init-function

I don't tell it.

> 2. How do I tell the compiler/linker which functions I want to export (I
> marked them with EXPORT in the file already, but they didn't seem to be
> available in the created DLL)

The complete syntax is:

gcc -shared -o cyg${module}.dll \
    -Wl,--out-implib=lib${module}.dll.a \
    -Wl,--export-all-symbols \
    -Wl,--enable-auto-import \
    -Wl,--whole-archive ${old_lib} \
    -Wl,--no-whole-archive ${dependency_libs}

Where ${module} is the name of your DLL, ${old_lib} are all
objectfiles, bundled together in a static lib or single object
files and the ${dependency_libs} are importlibs you need to
link against, e.g '-lpng -lz -L/usr/local/special -lmyspeciallib'

All symbols are exported then because you tell the linker to do so:
-Wl,--export-all-symbols


Gerrit
-- 
"All faults& bugs are mine - Robert"
    from squid/acinclude.m4,   Sun Apr 21 05:21:21 2002


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019