What is a good strategy for finding undefined symbols...

Andrew Wiley wiley.andrew.j at gmail.com
Sat May 12 10:31:48 PDT 2012


On Sat, May 12, 2012 at 12:22 PM, WhatMeWorry <kc_heaser at yahoo.com> wrote:

>  Looks like you are trying to link. Libraries are not linked they are just
>> compiled. Then object files are put together into library file.
>> Link produces *executable* (yeah I recall that was hard to get at first).
>>
>>>
>>>
> Wait, isn't that the whole point of libraries, that they are pre-compiled?
> Linking just resolves their addresses?
>

Yes and no. You have to link *dynamic* libraries to resolve addresses, but
you're dealing with a static library. "Static library" is to some extent a
misnomer because you don't link them at all; they're basically a bunch of
object files thrown into an archive file. Addresses get resolved when you
link an executable and all those object files get included from inside the
archive.


> Anyway, I set the LIB environment variable to point to where my druntime
> and phobos libraries (with absolute paths even) like so:
>
> set LIB=C:\D\dmd2\src\druntime\**lib;C:\D\dmd2\src\phobos
>
> but when I redo the link step,I am still seening the undefined symbols
> like in my original posting.
>
> I love programming, but I hate building. Is this what Andrei means by code
> for "being" as opposed to code for "doing:.
>
>
One of the downsides of native compilation is that the toolchain is a much
more complex system than it is with VM languages (and interpreted languages
don't need a toolchain at all).

Unfortunately, I use GDC on Windows and Linux, so I can't tell you exactly
the command to create a static library with DMD, but I can tell you that
you don't need to invoke optlink.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20120512/e0e7a17c/attachment.html>


More information about the Digitalmars-d-learn mailing list