Shared library loading and static constructor

Andre Pany andre at s-e-a-p.de
Sat Mar 23 09:37:16 UTC 2019


On Friday, 22 March 2019 at 17:52:34 UTC, Sobaya wrote:
> On Friday, 22 March 2019 at 11:00:32 UTC, Andre Pany wrote:
>> On Friday, 22 March 2019 at 10:51:58 UTC, Sobaya wrote:
>>> [...]
>>
>> As far as I know different to windows, linus will not search 
>> current working directory for a.so. if this is the issue here, 
>> you have different possibilities. You could determine the 
>> current working directory and use std.path: buildPath to 
>> create an absolute path to a.so.
>> This path you can then use for Runtime.loadLibrary.
>>
>> Or you can set the environment variable LD_LIBRARY_PATH.
>>
>> I do not know what is the correct way on linux.
>>
>> Kind regards
>> Andre
>
> This is not a problem of path, I think.
>
> Because when I do not write static constructor in b.d, that 
> code works.
>
> This problem occurs only when static constructor is used.

Did you noticed this thread?
https://forum.dlang.org/post/eumnxgxtjrvvkhxpwjug@forum.dlang.org

The author has an example for shared static this and it seems it 
works for him although he has some other issues with gc.

Kind regards
Andre


More information about the Digitalmars-d-learn mailing list