Cross-platform dynamic libraries (GNU/Linux, Mac OS X, Windows, ...)

Tomas Lindquist Olsen tomas at famolsen.dk
Mon Sep 10 10:29:44 PDT 2007


Gregor Richards wrote:

> Hugues De Keyzer wrote:
>> Another question: is it safe to directly load a mangled D symbol like
>> this:
>> 
>> void* test = dlsym(handle, "_D8mymodule8MyModule4testFZv");
>> 
>> for static void MyModyle.test()?
>> 
>> It works, but will it work an all platforms?
>> 
> 
> The mangling is the same on all platforms, so that should work, but is
> bound to break eventually. Better would be to make an extern (C) symbol
> in the loaded library.
> 
>   - Gregor Richards

There is also the .mangleof property.



More information about the Digitalmars-d mailing list