Hi,

I call a C function from a dll (SO on linux). While the following code works fine for DMD on windows, there are strange errors for LDC on windows. Also the equivalent code does not work for DMD/LDC on linux. (When calling other functions from the dll and passing the model reference, this functions are failing).

Function "Open" gets a path to a model and return via argument pModel the reference. I am not 100% sure whether I call function Open correctly in regards to the pModel
argument.

extern(C) nothrow @nogc
{
        alias Model = void*;

alias da_Open = Status function(const(char)* path, Model* pModel);
}

__gshared {
        da_Open Open;
}

Open = cast(da_Open) GetProcAddress(h, "Open");
Model model;
string modelFilePath = "...";

auto status = Open(modelFilePath.toStringz, &model);

Is &model correct?

Kind regards
André

Reply via email to