D - Shared libs on Linux
- Stephan Wienczny (5/5) Apr 16 2004 Hallo,
- David Friedman (6/13) Apr 16 2004 The gcc front end can produce shared libraries, but there may some
- Stephan Wienczny (5/23) Apr 16 2004 I tryed using aap to create a d lib. The the docs it says it is not
- Lars Ivar Igesund (10/34) Apr 17 2004 The A-A-P docs are slightly inaccurate, because support for GDC isn't
- David Friedman (24/50) Apr 17 2004 Here's a little formula for building a shared library using libtool and
- Mike Hearn (13/17) Apr 17 2004 I should note that unless the output of gdc has a stable ABI (unlikely
- serge (11/27) Apr 17 2004 But what about using shared library written in D language from existing
Hallo, is it possible to create shared libs? The dmd docs say its not yet possible. Can it be done using the gcc frontend? Stephan
Apr 16 2004
The gcc front end can produce shared libraries, but there may some issues with Phobos itself not (yet) being shared library. The only thing I know will not work is static constructors and destructors in dynamically loaded modules. David Stephan Wienczny wrote:Hallo, is it possible to create shared libs? The dmd docs say its not yet possible. Can it be done using the gcc frontend? Stephan
Apr 16 2004
David Friedman wrote:The gcc front end can produce shared libraries, but there may some issues with Phobos itself not (yet) being shared library. The only thing I know will not work is static constructors and destructors in dynamically loaded modules. David Stephan Wienczny wrote:I tryed using aap to create a d lib. The the docs it says it is not possible... Is it possible to create a lib using the GDC project? StephanHallo, is it possible to create shared libs? The dmd docs say its not yet possible. Can it be done using the gcc frontend? Stephan
Apr 16 2004
Stephan Wienczny wrote:David Friedman wrote:The A-A-P docs are slightly inaccurate, because support for GDC isn't added. DMD isn't able to create shared libs on Linux. A-A-P should be able to create static libs on Linux using DMD, but I have personally never tested it. It might fail miserably.The gcc front end can produce shared libraries, but there may some issues with Phobos itself not (yet) being shared library. The only thing I know will not work is static constructors and destructors in dynamically loaded modules. David Stephan Wienczny wrote:I tryed using aap to create a d lib. The the docs it says it is not possible...Hallo, is it possible to create shared libs? The dmd docs say its not yet possible. Can it be done using the gcc frontend? StephanIs it possible to create a lib using the GDC project?Support for GDC will be added to A-A-P, but I don't really have the equipment to test it properly myself at the moment. Whether GDC as a standalone program is able to do what you want, I can't say. Lars Ivar Igesund
Apr 17 2004
Here's a little formula for building a shared library using libtool and gdc. If you don't like libtool's '.lo','.la' stuff, you can still use it to figure out what magic commands are needed to build shared libraries for your OS. David LIBTOOL=`which glibtool || which libtool` $LIBTOOL --tag=CC --mode=compile gdc -c -o shllib.lo shllib.d $LIBTOOL --tag=CC --mode=link gdc $NOSTDLIB -o libshllib.la \ shllib.lo -rpath `pwd`/.libs $LIBTOOL --tag=CC --mode=link gdc -o shlusr shlusr.d libshllib.la Stephan Wienczny wrote:David Friedman wrote:The gcc front end can produce shared libraries, but there may some issues with Phobos itself not (yet) being shared library. The only thing I know will not work is static constructors and destructors in dynamically loaded modules. David Stephan Wienczny wrote:I tryed using aap to create a d lib. The the docs it says it is not possible... Is it possible to create a lib using the GDC project? StephanHallo, is it possible to create shared libs? The dmd docs say its not yet possible. Can it be done using the gcc frontend? Stephan
Apr 17 2004
On Fri, 16 Apr 2004 19:02:56 -0400, David Friedman wrote:The gcc front end can produce shared libraries, but there may some issues with Phobos itself not (yet) being shared library. The only thing I know will not work is static constructors and destructors in dynamically loaded modules.I should note that unless the output of gdc has a stable ABI (unlikely given that D itself isn't stable yet), shared libraries are mostly useless as nobody other than yourself can reliably link to them. You might be tempted to split a single project into shared libraries - resist! There are no real performance gains to be had from this approach and in fact, there will probably be severe performance penalties. Combining everything into one large static binary is probably the best way for now. We need a stable D (and ABI) to really kick off with good language bindings and 3rd party D libs, so I'd really like to know how soon this might occur. thanks -mike
Apr 17 2004
In article <pan.2004.04.17.11.05.11.747580 navi.cx>, Mike Hearn says...On Fri, 16 Apr 2004 19:02:56 -0400, David Friedman wrote:But what about using shared library written in D language from existing C++ project? If I understand it right, D is ABI is compatible with C. I would like to try porting some of my code to D, but converting entire project is too time consuming and error prone. Converting it one module at a time probably is safer. Anyway, I'm not so interested in shared libraries right now, but I would like to be able to link D and C code together in one project (most of the code written in C/C++ and a few D modules). I still did not make any experiments, maybe it is already possible, but absence of shared libraries support seems a bad sign to me.The gcc front end can produce shared libraries, but there may some issues with Phobos itself not (yet) being shared library. The only thing I know will not work is static constructors and destructors in dynamically loaded modules.I should note that unless the output of gdc has a stable ABI (unlikely given that D itself isn't stable yet), shared libraries are mostly useless as nobody other than yourself can reliably link to them. You might be tempted to split a single project into shared libraries - resist! There are no real performance gains to be had from this approach and in fact, there will probably be severe performance penalties. Combining everything into one large static binary is probably the best way for now. We need a stable D (and ABI) to really kick off with good language bindings and 3rd party D libs, so I'd really like to know how soon this might occur.
Apr 17 2004