Shared object with Sqlite?
Benjiro via Digitalmars-d
digitalmars-d at puremagic.com
Mon Dec 12 05:12:35 PST 2016
A silly question that has me pounding my head for a while. I am
trying to compile a shared object WITH sqlite3 included into the
shared object.
>dmd -c dll.d -fPIC -L-ldl
>-L/usr/lib/x86_64-linux-gnu/libsqlite3.a
>dmd -oflibdll.so dll.o -shared -defaultlib=libphobos2.so
>-L-rpath=/root/dlangProjects
No ability to access the C object. It does not even seem to be
included based upon the file size.
This works ( using the already existing shared sqlite3 object )
but i am just linking the sqlite3 to the shared object.
>dmd -c dll.d -fPIC
>dmd -oflibdll.so dll.o -shared -defaultlib=libphobos2.so
>-L-rpath=/root/dlangProjects
>-L/usr/lib/x86_64-linux-gnu/libsqlite3.so
And for fun... this one just errors out big time ;)
>dmd -c dll.d -fPIC
>dmd -oflibdll.so dll.o -shared -defaultlib=libphobos2.so -L-ldl
>-L/usr/lib/x86_64-linux-gnu/libsqlite3.a
> /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libsqlite3.a(sqlite3.o):
> relocation R_X86_64_PC32 against symbol `sqlite3_strnicmp' can
> not be used when making a shared object; recompile with -fPIC
>/usr/bin/ld: final link failed: Bad value collect2: error: ld
>returned 1 exit status
The goal is to have the sqlite3 embedded into the shared object
so i can have my own orm in D build into the dll.d ( for easy
distribution ). And then my main programs can dynamically load
this shared object.
Complicated. I am probably mixing things up but its a bit of
experimentation. ;)
More information about the Digitalmars-d
mailing list