undefined symbol: rt_finalize
Mike
none at none.com
Thu Feb 27 22:17:58 PST 2014
On Thursday, 27 February 2014 at 06:25:45 UTC, Tolga Cakiroglu
wrote:
> I am trying to compile a shared library on Linux and use it.
>
> lib.d
> ---------------------------
> import core.runtime;
>
> class A{}
>
> extern(C) void foo(){
> Object obj = new Object();
>
> A objA = new A();
>
> char[] c = new char[ 1024 ];
>
> destroy( objA );
> destroy( c );
> }
>
>
> makefile:
> --------------------------
> lib:
> dmd -c lib.d -fPIC -debug -gc -g -w -wi
> gcc --shared lib.o -o lib.so
>
>
> After getting the `foo` symbol in the app by using dlsym, I
> call it, the following is output on the shell:
>
> library is loaded now
> Running functions...
> ./app: symbol lookup error: ./lib.so: undefined symbol:
> rt_finalize
>
>
> Where exactly is that function linked into an application? and
> why is it not linked into the library? Does it require an extra
> flag?
rt_finalize is defined in lifetime.d
(https://github.com/D-Programming-Language/druntime/blob/master/src/rt/lifetime.d).
Its part of the D runtime. It just forwards to rt_finalize2.
I don't know why you are getting an undefined symbol, though. Is
the signature different?
More information about the Digitalmars-d-learn
mailing list