Trouble with DLL address

2013-01-14 Thread dnewbie
I have a DLL which exports a function GetFunction. GetFunction returns a pointer to RealFunction. Now I want to run RealFunction from my D program, but for some reason I get the wrong address. Here is the code. dll64.c - #define WIN32_LEAN_AND_MEAN #include windows.h int __stdcall

Re: Trouble with DLL address

2013-01-14 Thread dennis luehring
Just ignore my post - too early in the morning :( Am 14.01.2013 10:19, schrieb dennis luehring: http://dlang.org/type.html int = signed 32 bits but don't you need long in D Am 14.01.2013 10:13, schrieb dnewbie: I have a DLL which exports a function GetFunction. GetFunction returns a pointer

Re: Trouble with DLL address

2013-01-14 Thread dennis luehring
http://dlang.org/type.html int = signed 32 bits but don't you need long in D Am 14.01.2013 10:13, schrieb dnewbie: I have a DLL which exports a function GetFunction. GetFunction returns a pointer to RealFunction. Now I want to run RealFunction from my D program, but for some reason I get the

Re: Trouble with DLL address

2013-01-14 Thread Andrej Mitrovic
On 1/14/13, dnewbie r...@myopera.com wrote: FuncPtr realFunction = cast(FuncPtr) getFunction(); Make that: FuncPtr realFunction = cast(FuncPtr) getFunction; Don't call the FARPROC, just cast it.

Re: Trouble with DLL address

2013-01-14 Thread dnewbie
The problem is FARPROC. Thank you everybody. Solution: import core.runtime; import std.c.windows.windows; import std.stdio; alias extern(Windows) int function(int) FuncPtr; alias extern(Windows) FuncPtr function() GetFuncPtr; int main(string[] args) { HMODULE dll=