Access Violation when passing the result of a C function directly to a D function?

Johan Engelen j at j.nl
Sun Sep 17 21:34:10 UTC 2017


On Friday, 15 September 2017 at 04:01:13 UTC, Timothy Foster 
wrote:
> I've been calling it like so:
>
> ErrorFMOD(FMOD_System_Create(&system), "Error Creating System: 
> ");
>
> Making the calls without my helper function doesn't cause an 
> Access Violation.
> Calling it like this is the only thing that seems to fix it:
>
> auto result = FMOD_System_Create(&system);
> ErrorFMOD(result, "Error Creating System: ");
>
> Is this a known issue, or am I required to save the result of a 
> C function to variable before passing it into another function 
> or?

This is very strange and you are certainly not required to save 
the result in a temp variable first.
Do you have a small but full testcase that we can look at? (did 
you try with another compiler, LDC or GDC?)
(note that debug information may be off, so the crash may happen 
in a different location from where it is reported to happen)

-Johan



More information about the Digitalmars-d-learn mailing list