Extern function definition (BASS-Lib Call)

BlitzMax Forums/BlitzMax Programming/Extern function definition (BASS-Lib Call)

okay, new problem ;)

i wanted to try the callback function to save the stream data:

Function proc(buffer:Byte Ptr, length:Int, user:Object)
	If fstream = Null
		fstream = WriteFile("test.mp3")
	End If
	If buffer = Null
		CloseFile(fstream)
	Else
		For Local i:Int = 0 Until length
			WriteByte(fstream, buffer[i])
		Next
	End If
End Function


In Debug-Mode Blitz always crashes (sometimes a error is written on the debug window, i've never seen before):
kernelErrorToOSStatus: OSStatus = -1 (error = 15)
Debugger Error:scope stack underflow
Debugger Error:scope stack underflow


In Release-Mode it first seems to work, but the ActivityMonitor shows that memory usage of the app grows continuesly (even if I close the stream then and now and reopen it).

Probably, it's just to late now for me. I will have a look at it tomorrow again...