Access Violation when passing the result of a C function directly to a D function?
Timothy Foster via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Sep 15 17:53:32 UTC 2017
On Friday, 15 September 2017 at 16:55:27 UTC, Kagamin wrote:
> On Friday, 15 September 2017 at 04:01:13 UTC, Timothy Foster
> wrote:
>> am I required to save the result of a C function to variable
>> before passing it into another function or?
>
> No. You probably have stack corruption. Does it crash if
> FMOD_System_Create returns ok?
FMOD_System_Create is always returning FMOD_OK. I have zero
issues when I save the result of a fmod function to a variable
before passing it to my helper function.
Sometimes crashes:
ErrorFMOD(Some_FMOD_Function(...), "print text");
Never crashes:
auto result = Some_FMOD_Function(...);
ErrorFMOD(result, "print text");
The crashes happen even if ErrorFMOD is an empty function:
void ErrorFMOD(int r, string s = ""){
//nothing happening
}
More information about the Digitalmars-d-learn
mailing list