7 messages in com.perforce.jammingshared/DLL library support?
FromSent OnAttachments
Xiao...@aero.gla.ac.uk27 May 1997 03:53 
Xiao...@aero.gla.ac.uk27 May 1997 05:09 
C.Co...@slh0633.wins.icl.co.uk C.Coles@slh0633.wins.icl.co.uk27 May 1997 05:45 
Laur...@sybase.com27 May 1997 18:28 
Xiao...@aero.gla.ac.uk28 May 1997 06:48 
Xiao...@aero.gla.ac.uk28 May 1997 08:31 
Laur...@sybase.com28 May 1997 17:00 
Subject:shared/DLL library support?
From:C.Co...@slh0633.wins.icl.co.uk C.Coles@slh0633.wins.icl.co.uk (C.Co@slh0633.wins.icl.co.uk C.Coles@slh0633.wins.icl.co.uk)
Date:05/27/1997 05:45:09 AM
List:com.perforce.jamming

Xiaokun Zhu,

I have been working on a DLL rule/actions for NT recently and have something that sort of works but needs refinement.

One of my objectives is to be able to specify a target which may be selected to be a static library, a shared object or a DLL using one rule, IYSWIM.

i.e

WilfsLibrary wibble : wibble1.c wibble2.c ;

which would generate libwibble.a, libwibble.so, wibble.lib or wibble.dll (etc) dependent on variable settings and platform.

So far I have a rule Dll and supporting actions which does some of what I need - I include this below along with an example invocation from a Jamfile. It is just based on the Main and MainFromObjects stuff in Jambase. I'm sorry but I can't guarantee that it is working coz it's a few weeks now since I was working on it and I had to drop it rather quickly.

Hope this helps. If you come up with a good generic rule I'd be interested in seeing it. If I do, I will post it :-)

Whatever, I will try and post an updated, commented version as it gets a bit better. I think the comments are important because I find it *really hard* to write these rules.

Cheers, Wilf Coles DAIS COnsultant

wilf@iclosl.com wi@cix.compulink.co.uk

================================================================== Jamrules stuff:

DLLLINK = link ; SUFDLL = .dll ; rule Dll {

DllFromObjects $(<) : $(>:S=$(SUFOBJ)) ; Objects $(>) ; }

rule DllFromObjects { local s t u u1 u2 u3 ;

# Add grist to file names

makeGristedName s : $(>) ;

makeSuffixed t $(SUFDLL) : $(<) ;

if $(t) != $(<) { DEPENDS $(<) : $(t) ; NOTFILE $(<) ; }

u = $(t:BS=.def) ; SEARCH on $(u) = $(DLLDEF_DIR) ; DEF on $(t) = $(u) ; DEPENDS $(t) : $(u) ;

u1 = $(t:BS=.lib) ; IMPLIB on $(t) = $(u1) ; DEPENDS $(u1) : $(s) ; MakeLocate $(u1) : $(DLLIMPLIB_DIR) ;

u2 = $(t:BS=.pdb) ; PDB on $(t) = $(u2) ; DEPENDS $(u2) : $(s) ; MakeLocate $(u2) : $(DLLPDB_DIR) ;

# made by side effect (?) u3 = $(t:BS=.exp) ; DEPENDS $(u3) : $(s) ; MakeLocate $(u3) : $(DLLIMPLIB_DIR) ;

# make compiled sources a dependency of target

DEPENDS dll : $(t) ; DEPENDS $(t) : $(s) ; MakeLocate $(t) : $(LOCATE_TARGET) ;

Clean clean : $(t) $(u1) $(u2) $(u3) ;

DllLink $(t) : $(s) ; }

DLLLINKLIBS = kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ; DLLLINKLIBS += $(DAIS_LIB)$(SLASH)dais32.lib ;

DLLLINKFLAGS = /nologo /subsystem:windows /dll /incremental:no /machine:I386 ;

actions DllLink bind NEEDLIBS DEF EXP PDB IMPLIB { # next line should be one line not two! $(DLLLINK) /out:$(<) $(>) $(DLLLINKFLAGS) $(NEEDLIBS) $(DLLLINKLIBS) /pdb:$(PDB) /def:$(DEF) /implib:$(IMPLIB) }

NOTFILE dll; DEPENDS all : dll ;

========================================================================== example invocation in Jamfile:

DLLDEF_DIR = $(WIBBLE)$(SLASH)defs ; DLLPDB_DIR = $(WIBBLE)$(SLASH)src ; DLLIMPLIB_DIR = $(WIBBLE)$(SLASH)src ;

Dll wibble.dll : wibble0.c wibble1.c ;