"Nick Sabalausky" <[email protected]> wrote in message
news:[email protected]...
> I've tried all sorts of stuff and looked all over, but I'm completely at a
> loss. How do I link in a static lib on the command line?
And I don't mean "with C" or anything like that, just ordinary D.
> type main.d
module main;
import theLib;
void main()
{
foo();
}
> type theLib.d
module foo;
import std.stdio;
void foo()
{
writeln("In foo");
}
> dmd theLib.d -lib
> dmd main.d -LtheLib.lib
OPTLINK (R) for Win32 Release 8.00.2
Copyright (C) Digital Mars 1989-2009 All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
OPTLINK : Warning 9: Unknown Option : NOITHELIB.LIB
main.obj(main)
Error 42: Symbol Undefined _D3foo12__ModuleInfoZ
main.obj(main)
Error 42: Symbol Undefined _D3foo3fooFZv
--- errorlevel 2
Same results for "-LtheLib".
I saw something about "-L-ltheLibNameHere" somewhere, but "-L-ltheLib.lib"
gets me:
OPTLINK (R) for Win32 Release 8.00.2
Copyright (C) Digital Mars 1989-2009 All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
OPTLINK : Warning 9: Unknown Option : LTHELIB.LIB
main.obj(main)
Error 42: Symbol Undefined _D3foo12__ModuleInfoZ
main.obj(main)
Error 42: Symbol Undefined _D3foo3fooFZv
--- errorlevel 2
And with "-L-ltheLib" the message just says "LTHELIB" instead of
"LTHELIB.LIB"