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

2017-09-17 Thread Johan Engelen via Digitalmars-d-learn
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 see

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

2017-09-15 Thread Timothy Foster via Digitalmars-d-learn
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 FM

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

2017-09-15 Thread Kagamin via Digitalmars-d-learn
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?

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

2017-09-15 Thread Timothy Foster via Digitalmars-d-learn
On Friday, 15 September 2017 at 10:33:55 UTC, Vadim Lopatin wrote: On Friday, 15 September 2017 at 04:01:13 UTC, Timothy Foster wrote: [...] Probably you have to use const char * msg when interfacing with C. string is a struct - size_t length and const char * value The string doesn't touch

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

2017-09-15 Thread Vadim Lopatin via Digitalmars-d-learn
On Friday, 15 September 2017 at 04:01:13 UTC, Timothy Foster wrote: I'm compiling on Windows 7 x64, DMD32 D Compiler v2.075.1 and I'm using Derelict Fmod to handle audio in my application. Every Fmod function returns an int telling me if the function ran okay, or if there was an error. I've wri

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

2017-09-14 Thread Timothy Foster via Digitalmars-d-learn
I'm compiling on Windows 7 x64, DMD32 D Compiler v2.075.1 and I'm using Derelict Fmod to handle audio in my application. Every Fmod function returns an int telling me if the function ran okay, or if there was an error. I've written the following helper function that will print something for me