Shared object with Sqlite?

Mike Parker via Digitalmars-d digitalmars-d at puremagic.com
Mon Dec 12 06:11:49 PST 2016


On Monday, 12 December 2016 at 13:12:35 UTC, Benjiro wrote:
> 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.
>

Right, because there's no linking taking place when you compile 
dll.d. The -c option means compile only. The link step happens in 
the second command line, when you build the shared library. Any 
linker options you pass when compiling with -c are simply ignored.
>
>
> 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
>

So replace libsqlite3.so with the static library here.




More information about the Digitalmars-d mailing list