Strange stack variable corruption error after calling extern(C) function

Benjamin Thaut via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu May 5 02:42:00 PDT 2016


On Wednesday, 4 May 2016 at 17:53:32 UTC, cc wrote:
>
> The OS is Win64 though the program is being compiled as 32-bit 
> and I'm using the 32-bit distributed DLL.
> fmod.dll: PE32 executable (DLL) (GUI) Intel 80386, for MS 
> Windows
>
> Tried int and long as the return type, same issue both ways.  
> Tried void too just in case, same thing though.

Could you please post the definition of FMOD_RESULT. Its possible 
that the create sound function returns it on stack and not inside 
a register. This is usually the case if FMOD_RESULT is defined as 
a struct in C/C++. But its hard to say. In your case I would 
actually look at the disassembly and step through it to see where 
its going wrong and messing up the stack.


More information about the Digitalmars-d-learn mailing list