Menu

#48 .NET Bindings: aiImportFileFromMemory broken

Release 3.0
pending
nobody
Assimp lib (91)
9
2013-10-11
2011-09-04
No

The current way aiImportFileFromMemory is wrapped doesn't seem sane. The native function looks like this:
ASSIMP_API const aiScene* aiImportFileFromMemory ( const char * pBuffer,
unsigned int pLength,
unsigned int pFlags,
const char * pHint
)

swig generates this .NET method:
public static aiScene aiImportFileFromMemory(string arg0, uint arg1, uint arg2, string arg3)

I think swig wraps const char * as .NET string. This cannot work as a .NET string is not for storing binary data. What's required here is a byte[] array.

Even in C++ the signature is confusing. While a char * may be more convenient inside the function to do pointer calculations the signature should use void* to make it very clear that a chunk of binary data should be passed in.

Discussion

  • Alexander Gessler

    • priority: 5 --> 9
     
  • Kim Kulling

    Kim Kulling - 2013-10-11
    • status: open --> pending
    • Group: --> Release 3.0
     
  • Kim Kulling

    Kim Kulling - 2013-10-11