My situation is as follows. My software is to be written in VB6, but it will need to load images with LibPNG. The problem with LibPNG is it uses CDECL calling convention, so that means I will need to make a STDCAL wrapper for it, and the easiest way I can think of is in assembly. But even this has an issue. The LibPNG functions do not read from memory, so loading the PNG file into memory and then letting LibPNG read it from memory is not an option. Nor does it let you specify the filename and then let LibPNG load the file internally. The ONLY input you are allowed to provide to LibPNG, for loading the PNG file, is a pointer to a FILE struct (which was created when you used the fopen function in C or C++), which is EXCLUSIVELY a C and C++ feature. LibPNG is therefore strongly tied to C and C++, vastly limiting what programming languages it can be used with. I want to write my wrapper in ASM, and use the Windows API file loading function called CreateFile. In order to duplicate the C functionality that LibPNG is expecting in the FILE struct, I'm going to need to figure out EXACTLY what the structure of a FILE struct is. What fields the struct has, and exactly what each field is used for, so I can implement this in ASM.
↧