On 5/14/2012 7:59 PM, crashtua wrote:
But it is something strange, one function need '_' and another dont:(
In D dll i have:

extern (C) int function() f;
alias typeof(f) myfunc;

export extern (C) int retten()
{
return 10;
}
export extern (C) void setf(myfunc ff)
{
f=ff;
}
export extern (C) int ret()
{
return f();
}

In C code:

int(*retten)() = (int (*)())GetProcAddress(dLib,"_retten");
int(*ret)() = (int (*)())GetProcAddress(dLib,"ret");
void(*setf)(int(*)()) = (void (*)(int(*)()))GetProcAddress(dLib,"setf");

Why so strange?

I guess you are hitting this linker bug: http://d.puremagic.com/issues/show_bug.cgi?id=3956

A work around is to add the exports to the .def file.

Reply via email to