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?

I made some changes in code and culled a big part of it. Now the new error is:

./app: symbol lookup error: ./lib.so: undefined symbol: _d_newarrayiT


The exact codes are below:

app.d
------------------------------------
import core.sys.posix.dlfcn;

void main(){
        void *lh = dlopen("./lib.so", RTLD_LAZY);
void function() foo = cast(void function())( dlsym( lh, "foo" ) );
        foo();
}


lib.d
------------------------------------
class A{}

extern(C) void foo(){
        Object obj = new Object();

        A objA = new A();

        char[] c = new char[ 1024 ];

        clear( objA );
        clear( obj );
        clear( c );
}


makefile
------------------------------------
all: clean lib app

lib:
        dmd -c lib.d -fPIC -debug -gc -g -w -wi
        gcc --shared lib.o -o lib.so

app:
        dmd app.d -L-ldl -L-lrt -debug -gc -g -w -wi

clean:
        rm -f lib.so
        rm -f lib.o
        rm -f app

Reply via email to