Linking to C

scrappylildude sdl at yahoo.com
Tue Nov 2 17:47:45 PDT 2010


Hello,

New to D, but I am loving it so far.

I am having some trouble linking to a C library static library (LibRaw 0.10.0).  I ran htod on the LibRaw
header files, and fixed up the resulting file by hand.

Now when I compile and attempt to link, I get one error:

Undefined symbols:
  "_D16libraw_c_headers12__ModuleInfoZ", referenced from:
      _D10helloworld12__ModuleInfoZ in helloworld.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
--- errorlevel 1

Obviously I don't have any identifiers by these names.  I wrote a simple library which printf's "Hello
World" and linked to it without problems.  So I thought the problem might be due to name mangling
incompatibilities, so I recompiled libraw under gcc4.2 and llvm-gcc and got the same issue both times.

Can anyone provide a clue?  I know the linker can't resolve the above, but I have no idea how to go
about fixing it.

Environment: Mac OS X 10.6.4, DMD v2.049.


More information about the Digitalmars-d mailing list