Using static d libs in C++
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Sat Sep 29 04:19:04 PDT 2007
Chrono wrote:
> Hello!
>
> I'm new to d. And I'd like to use some d functions in my c++ projects by
> building them static and linking them.
>
> my platform: dmd and g++ on linux.
[snip]
> Compiling them wihout linking.
> ./dmd -c sub.d
> g++ -c main.cpp
>
> everything works fine, I get main.o and sub.o but then
>
> gcc main.o sub.o -o myprogram -m32 -lstdc++ -Xlinker -L./dmd/bin/../lib
> -lphobos -lpthread -lm
>
> /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/libphobos.a(deh2.o): In
> function `_D4deh213__eh_finddataFPvZPS4deh213DHandlerTable':
> internal/deh2.d:(.gnu.linkonce.t_D4deh213__eh_finddataFPvZPS4deh213DHandlerTable+0x9):
> undefined reference to `_deh_beg'
[snip]
>
> any ideas?
IIRC those symbols are emitted when DMD sees the main() function. Any
chance you could write your main() in D?
More information about the Digitalmars-d-learn
mailing list