delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/03/22/11:57:47

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
To: John Mullee <jmullee AT hotmail DOT com>
Cc: cygwin AT sourceware DOT cygnus DOT com
Subject: Re: Making DLL's.
References: <1 DOT 5 DOT 4 DOT 32 DOT 19990318210722 DOT 0067d298 AT lola DOT univ-lemans DOT fr> <3564 DOT 990319 AT is DOT lg DOT ua> <36F258AB DOT CC1A1788 AT atos-group DOT com> <199903191530 DOT KAA01054 AT envy DOT delorie DOT com> <u1zihvmrf DOT fsf AT oranda DOT demon DOT co DOT uk> <36F66173 DOT 1F71CC18 AT hotmail DOT com>
MIME-Version: 1.0
From: gvaughan AT oranda DOT demon DOT co DOT uk (Gary V. Vaughan)
Date: 22 Mar 1999 16:55:33 +0000
In-Reply-To: John Mullee's message of "Mon, 22 Mar 1999 16:27:47 +0100"
Message-ID: <uzp55lb0a.fsf@oranda.demon.co.uk>
Lines: 51
User-Agent: Gnus/5.070079 (Pterodactyl Gnus v0.79) Emacs/20.3

John Mullee <jmullee AT hotmail DOT com> writes:

> > That is I need to make sure that any data item that will be imported from a
> > dll has __attribute__((dllimport)), and any data item imported from a static
> > library cannot have this attribute.  Obviously, in a makefile driven build
> 
> Normally, in win32, this has to be specified manually - 
> with default being 'not exported'.
> RTFM for ".def" files:

Thanks for the reply, by this I know... perhaps a more concrete example:

I have two source files, lib.c and main.c, plus a header file lib.h.
I want to make a dll, `liblib.dll',  and an ar static archive, `liblib.a' from
the code in lib.c.  I will install both of these libraries plus the header
file, and can arrange for the linker to choose between the dll (for which I
will build an import library on the fly) and the static archive depending on
whether I ask for static linkage or not (gcc -static).

Obviously I need cpp to read lib.h when I build main.o (by adding #include
"lib.h").  I probably want cpp to read lib.h when I link lib.o (destined to be
included in liblib.a) and lib.lo (destined for liblib.dll) too, to get
function prototypes etc.

The difficult part is getting the correctly tagged declarations from the
header file to generate the correct assembly when I build main.lo (which I
will link against liblib.dll) and main.o (for liblib.a), otherwise I get
undefined _imp_foo errors at link time.

The really difficult part is designing a mechanism that allows someone else
to link liblib.dll or liblib.a by including lib.h...

The *really* difficult part is creating libdepend.h, whichdepends on
liblib.dll or liblib.a depending on whether I want to link a static executable
or not....

Is there a better solution to this than trying to find out the complete list
of libraries (and their types) against which each object will eventually be
linked so that I can tag data exports correctly when the asm code is
generated?

Cheers,
        Gary.
-- 
  ___              _   ___   __              _             
 / __|__ _ _ ___ _| | / / | / /_ _ _  _ __ _| |_  __ _ ___ 
| (_ / _` | '_|// / |/ /| |/ / _` | || / _` | ' \/ _` | _ \
 \___\__,_|_|\_, /|___(_)___/\__,_|\_,_\__, |_||_\__,_|//_/
PGP Key from/___/                      /___/               
http://www.cl.cam.ac.uk/PGP/pks-commands.html#extract      
http://pgp.ai.mit.edu/~bal/pks-commands.html#extract       


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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