creating a .so with gdc

Anders F Björklund afb at algonet.se
Fri May 4 00:12:16 PDT 2007


Carlos Santander wrote:

> Can somebody explain for the n-th time how to create a .so with GDC? 
> Here's what I'm getting:
> 
> $ gdc -fshared -Wl,-soname,libfoo.so -o libfoo.so foo.o
> /usr/bin/ld: unknown flag: -soname
> collect2: ld returned 1 exit status
> 
> That's on Mac OS X. How about also setting up a wiki page so it's easy 
> to find?

I haven't created a shared library with GDC, but the shared (.so) files 
on other platforms are known as either dynamiclib or bundle on Mac OS X.
Dynamic libraries are for linking to and bundles for loading at runtime,
for instance program plugins and modules for Perl or Python are bundles.

Using -soname should be equivalent to -install_name on Mac OS X. See:
http://developer.apple.com/documentation/developertools/gcc-4.0.1/gcc/Darwin-Options.html
$ gcc -dynamiclib -Wl,-install_name,libfoo.dylib -o libfoo.dylib foo.o
But my GDC says cc1d: error: unrecognized command line option "-fshared"

--anders


More information about the Digitalmars-d-learn mailing list