User-defined Types with Arrays / Extern Issues
BlitzMax Forums/BlitzMax Programming/User-defined Types with Arrays / Extern Issues
| ||
After a very long time I finally figured out that the DLL plugin I'm using in my BMax app doesn't like to get Type instances (translated from C Structs) which have arrays. (This is from Steinberg's VSTi-Plugin-Tech) The original: struct VstMidiEvent { VstInt32 type; VstInt32 byteSize; VstInt32 deltaFrames; VstInt32 flags; VstInt32 noteLength; VstInt32 noteOffset; char midiData[4]; char detune; char noteOffVelocity; char reserved1; char reserved2; }; My first attempt (not working, corrupted data): Type VstMidiEvent Field type_:Int Field byteSize:Int Field deltaFrames:Int Field flags:Int Field noteLength:Int Field noteOffset:Int Field midiData:Byte[4] Field detune:Byte Field noteOffVelocity:Byte Field reserved1:Byte Field reserved2:Byte End Type Working attempt: Type VstMidiEvent Field type_:Int Field byteSize:Int Field deltaFrames:Int Field flags:Int Field noteLength:Int Field noteOffset:Int Field midiData1:Byte Field midiData2:Byte Field midiData3:Byte Field midiData4:Byte Field detune:Byte Field noteOffVelocity:Byte Field reserved1:Byte Field reserved2:Byte End Type I'm sorry that I can't give any better example, but to create a test app and dll would require a very big effort, and I'm not even sure if this is a true bug or just something which is "not featured". In the second case, please document it, otherwise more people will have this pitfall. :/ |
| ||
BlitzMax arrays aren't C arrays, C arrays are part of the struct while BlitzMax arrays are equivalent of a pointer to array. |