shared library, function arguments order reversed?

xoxo xororwr at gmail.com
Mon May 26 07:46:54 UTC 2025


On Wednesday, 21 May 2025 at 10:43:17 UTC, kinke wrote:
> On Wednesday, 21 May 2025 at 08:09:23 UTC, xoxo wrote:
>> auto fn_test = cast(void function(int, int)) dlsym(lib, 
>> "test");
>
> This is the problem - you're casting the address to an 
> `extern(D)` function pointer. Use something like this:
> ```
> alias Fn = extern(C) void function(int, int);
> auto fn_test = cast(Fn) dlsym(lib, "test");
> ```

Thanks, it now works, I didn't know we could set it that way


More information about the Digitalmars-d-learn mailing list