Interfacing with C++, random errors

BlitzMax Forums/BlitzMax Programming/Interfacing with C++, random errors

For me your tests work correctly, although you have screen mode and render mode the wrong way around in the code above.

SuperStrict
Framework BRL.StandardIO
Import "config.cxx"

Extern
	Type TSSConfig
		Field render_mode:Int
		Field screen_mode:Int
		
		Method _pad1()
		Method _pad2()
		Method setScreenMode(mode:Int)
		Method setRenderMode(mode:Int)
		Method getScreenMode:Int()
		Method getRenderMode:Int()
		Method save:Int(filename:Byte Ptr)
	End Type
	
	Function CreateTSSConfig:TSSConfig()
	Function DestroyTSSConfig( t:TSSConfig )
	Function LoadTSSConfig:TSSConfig( filename:Byte Ptr )
EndExtern



Local t:TSSConfig = CreateTSSConfig()
t.setRenderMode(1)
t.setScreenMode(2)
t.save("test.dat")
DestroyTSSConfig(t)

t = LoadTSSConfig("test.dat") 
Print t.screen_mode
Print t.getScreenMode()
Print t.render_mode
Print t.getRenderMode()
DestroyTSSConfig(t)


Output:
2
2
1
1

No errors.