using d dll/lib with msvc program
Martin Drašar
drasar at ics.muni.cz
Mon May 14 12:15:09 PDT 2012
Dne 14.5.2012 19:59, crashtua napsal(a):
> 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?
It is probably related to this bug:
http://d.puremagic.com/issues/show_bug.cgi?id=3956
You will have to jump through some hoops to make it work nicely...
More information about the Digitalmars-d
mailing list