Dynamically Loading a D DLL From a C Program in Linux

bachmeier via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Oct 24 15:33:08 PDT 2014


I can't answer the first question, but for the second, I've given 
an example here:

http://forum.dlang.org/post/zfdvrwvgavykauczbreq@forum.dlang.org

I've done that many, many times and do not see any problems 
related to the runtime.

On Friday, 24 October 2014 at 20:59:20 UTC, John McFarlane wrote:
> I'm following the preliminary example "Dynamically Loading a D 
> DLL From a C Program" here: http://dlang.org/dll-linux.html#dso9
>
> Firstly, my output is different:
>
> +main()
> libdll.so is loaded
> dll() function is found
> dll()
> unloading libdll.so
> -main()
>
> If looks like static this and ~this are not being called.
>
> Secondly, when I replace printf with writeln, I get a seg 
> fault. Trying to do just about anything beyond adding numbers 
> and returning the result causes a similar crash.
>
> I'm wondering whether D runtime is being initialized correctly. 
> Can anyone suggest what I would do to ensure this? A more 
> finalized example would be useful also.
>
> DMD64 D Compiler v2.066.0
> Ubuntu 10.04 64bit
>
> Many thanks,
> John



More information about the Digitalmars-d-learn mailing list