Criteria for 1.0 (was: Re: If D becomes a failure, what's the key reason, do you think?)

Kirk McDonald kirklin.mcdonald at gmail.com
Thu Jul 13 12:44:13 PDT 2006


Kirk McDonald wrote:
> Walter Bright wrote:
> 
>> Kirk McDonald wrote:
>>
>>> Here's something that has been annoying me, and this week-old thread 
>>> is as good a place as any to bring it up: Shared library support on 
>>> Linux. I could not take D seriously if it did a "1.0" release without 
>>> this. I do hate to cram more on your plate, Walter, but I consider 
>>> this a more serious issue than even this import thing that has 
>>> gripped the newsgroup for the past week.
>>
>>
>>
>> I know about the shared library issue on Linux. And to tell the truth, 
>> I've been procrastinating on it. The big job, -fPIC, is done. I don't 
>> know how much beyond that needs to be done.
>>
>> Will the shared libraries work with GDC?
> 
> 
> Ha! Well, at least this simple case does:
> 
> [myso2.d]
> import std.stdio;
> 
> export extern(C)
> void mysoprint() { writefln("Hello 'so' world!"); }
> 
> [myso.d]
> export extern(C) void mysoprint();
> 
> [test.d]
> import myso;
> 
> void main() {
>     mysoprint();
> }
> 

Uhh, I forgot a line. :-)

$ gdc -fPIC -g -c -Wall myso2.d

> $ gdc -shared -Wl,-soname,libmyso.so -o libmyso.so myso2.o -lc
> /usr/bin/ld: warning: creating a DT_TEXTREL in object.
> 
> (Not sure what that means...)
> 
> $ sudo cp libmyso.so /usr/lib
> $ gdc -c test.d
> $ gdc test.o -Wl,-lmyso -o test
> $ ./test
> Hello 'so' world!
> 
> Sweet. However, I am a little concerned. When making DLLs on Windows, 
> there is some boilerplate code needed to initialize and shut down the GC 
> and do some other routine things. Is something like that needed here?
> 


-- 
Kirk McDonald
Pyd: Wrapping Python with D
http://dsource.org/projects/pyd/wiki



More information about the Digitalmars-d mailing list