undefined symbol: rt_finalize

evilrat evilrat666 at gmail.com
Thu Feb 27 20:36:22 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?

because there is no finalize. rt_init/rt_term is what you need

https://github.com/D-Programming-Language/druntime/blob/master/src/core/runtime.d#L30


More information about the Digitalmars-d-learn mailing list