www.digitalmars.com         C & C++   DMDScript  

D.gnu - gdc 0.12 on linux - shared library status

reply Peri Hankey <mpah thegreen.co.uk> writes:
Hello

I have some 3000 lines of code in a library that works when linked as a 
static library, but always crashes after a while when linked as a 
dynamic library.

When compiling to produce a shared library using '-fPIC -shared' I get
many messages of the form "Error: junk `(%ecx)' after expression".

If I just use '-shared' gdc produces a shared library, but this then 
crashes as outlined above. I take it that the -fPIC option is required, 
and that I am trying to run the wrong kind of code as shareable.

So I suppose my real question is: are we a long way from being able to 
make shared libraries on Linux?

The compiler is gdc-0.12-gcc-3.4.3 running in Mandrake 10.2 on a Celeron.

It would be very good to have shared libraries working, and
the code I am developing really needs to be available in that form.


Regards
Peri Hankey
Jun 04 2005
parent reply David Friedman <d3rdclsmail_a_ _t_earthlink_d_._t_net> writes:
Peri Hankey wrote:
 Hello
 
 I have some 3000 lines of code in a library that works when linked as a 
 static library, but always crashes after a while when linked as a 
 dynamic library.
 
 When compiling to produce a shared library using '-fPIC -shared' I get
 many messages of the form "Error: junk `(%ecx)' after expression".
 
 If I just use '-shared' gdc produces a shared library, but this then 
 crashes as outlined above. I take it that the -fPIC option is required, 
 and that I am trying to run the wrong kind of code as shareable.
 
 So I suppose my real question is: are we a long way from being able to 
 make shared libraries on Linux?
 
 The compiler is gdc-0.12-gcc-3.4.3 running in Mandrake 10.2 on a Celeron.
 
 It would be very good to have shared libraries working, and
 the code I am developing really needs to be available in that form.
 
 
 Regards
 Peri Hankey
 
Fix for assembler error and crashing: http://home.earthlink.net/~dvdfrdmn/d/gdc-0.12-pic.diff Shared libraries are supposed to be working now, but I had not been testing them interfaces and module dependencies. David
Jun 04 2005
parent Peri Hankey <mpah thegreen.co.uk> writes:
David Friedman wrote:
 Peri Hankey wrote:
 
 Hello

 I have some 3000 lines of code in a library that works when linked as 
 a static library, but always crashes after a while when linked as a 
 dynamic library.

 When compiling to produce a shared library using '-fPIC -shared' I get
 many messages of the form "Error: junk `(%ecx)' after expression".

 If I just use '-shared' gdc produces a shared library, but this then 
 crashes as outlined above. I take it that the -fPIC option is 
 required, and that I am trying to run the wrong kind of code as 
 shareable.

 So I suppose my real question is: are we a long way from being able to 
 make shared libraries on Linux?

 The compiler is gdc-0.12-gcc-3.4.3 running in Mandrake 10.2 on a Celeron.

 It would be very good to have shared libraries working, and
 the code I am developing really needs to be available in that form.


 Regards
 Peri Hankey
Fix for assembler error and crashing: http://home.earthlink.net/~dvdfrdmn/d/gdc-0.12-pic.diff Shared libraries are supposed to be working now, but I had not been testing them interfaces and module dependencies. David
David Thanks very much - that seems to have done the trick. I have now successfully combined a shared library written in D with code written in both D and C doing nontrivial things, and am very pleased. I'm aiming to surface soon with GPL stuff that I hope will be useful and interesting, and it should be more useful as a dynamic library. Regards Peri
Jun 04 2005