www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - linker meaning and how to compile static libs

reply Kim <kim ktr.co.nz> writes:
Hi,
I am compiling parts of the 7zip SDK (the 7zDec.exe) as a static lib.
I am having issues with compile a static lib (from c code, using dmc 
8.50) that I can use with D v1.072.
The main question is how do I either compile the library with the right 
version suffix ( 12)
Or get the linker to use the right version suffix ( 8)

Generate Lib
dmc -o -c ..\src\7zAlloc.c ... xxx.c
lib -c 7z.lib bin\7zAlloc.obj ... xxx.obj

lib contents:
_main7zDec 8

compile and link with .d:
xfbuild sevenz.d 7z.lib +o7zDec.exe +D=.deps +O=.objs +full +v +R 
-release -O -inline -L/M -version=Unicode -version=Tango 
-L/SUBSYSTEM:console:5

OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
.objs\sevenz.obj(sevenz)
  Error 42: Symbol Undefined _main7zDec 12
--- errorlevel 1

 From Kim
Feb 02 2012
parent Trass3r <un known.com> writes:
 The main question is how do I either compile the library with the right  
 version suffix ( 12)
 Or get the linker to use the right version suffix ( 8)
That's no version suffix. It's the number of bytes of the arguments IIRC. Windows calling convention.
Feb 03 2012