Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Date: Wed, 21 Aug 2002 02:53:43 +0200
From: "Gerrit P. Haase" <gp@familiehaase.de>
Reply-To: "Gerrit @ cygwin" <cygwin@cygwin.com>
Organization: Esse keine toten Tiere
X-Priority: 3 (Normal)
Message-ID: <187380682792.20020821025343@familiehaase.de>
To: Lostmind <lostmind@gmx.net>
CC: cygwin@cygwin.com
Subject: Re: Problems exporting my DLL functions...
In-Reply-To: <3D62A993.AC202DD5@gmx.net>
References: <3D5F1721.2808F1A3@gmx.net>
 <20020820035042.B98873DC3@cavall.jtang.org> <3D5F33EC.5F9A8D24@gmx.net>
 <39336161164.20020820143142@familiehaase.de> <3D62A993.AC202DD5@gmx.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

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/

