Try to create and load dynamic libraries on Linux

Ozan Sueel mobbel.alerts at gmail.com
Sat Nov 9 17:29:11 UTC 2019


Hi
I want to build a set of dynamic libraries in D on Linux.
Then I want to load these libraries dynamically.

So I wrote a app with "extern (D): void hello(string text)..."
compiled with dub / "targetType":"dynamicLibrary"

...works fine. App called libapp.so

Then I tried to call these libs in a second app with dub

"import core.runtime;"
"auto handler = Runtime.loadLibrary("./libapp.so");"

In result, I got the error message
collect2: error: ld returned 1 exit status
Error: linker exited with status 1

Isn't loadLibrary not enough for loading? Path seems to be 
correct.


Regards, Ozan


More information about the Digitalmars-d-learn mailing list