Dynamic D Library

Sergey Gromov snake.scaly at gmail.com
Tue Jul 28 16:51:24 PDT 2009


Tue, 28 Jul 2009 21:01:33 +0000 (UTC), BCS wrote:

> Reply to teo,
> 
>> On Mon, 27 Jul 2009 20:34:44 +0000, BCS wrote:
>> 
>>> Reply to teo,
>>> 
>>>> I did some tests and here are the results: D cannot be used in
>>>> Shared Objects. The only case that works is when no classes are
>>>> exported and when there are no references to Phobos within the
>>>> library.
>>>> 
>>> this works:
>>> 
>> it doesn't work with v2.031
>> 
>>> module test;
>>> int test1() { return 0; }
>> dmd complains:
>> 
>>> char[] test2() { return "hello world"; }
>>> 
>> test.d(3): Error: cannot implicitly convert expression ("hello world")
>> of type immutable(char)[] to char[]
>> 
>> when I change it to:
>> string test2() { return "hello world"; }
>> $ dmd main.d -L-L`pwd` -L-ltest
>> main.d(6): Error: undefined identifier test2
>> main.d(6): Error: function expected before (), not test2 of type int
>> main.d(7): Error: identifier 'C' is not defined
>> main.d(7): Error: C is used as a type
>> main.d(7): Error: new can only create structs, dynamic arrays or class
>> objects, not void's
>> main.d(7): Error: no property 'get' for type 'void'
>> main.d(7): Error: function expected before (), not __error of type int
> 
> That's not a SO realted problem. Try building it as a non-SO program, fix 
> any errors you get there and then go back to the SO version.
> 
> for starters try:
> 
> public string test2() { return "hello world"; }

Maybe "export string test2() {...}" ?

teo, such discussions belong in D.learn.



More information about the Digitalmars-d mailing list