Page 1 of 1

Extended functionality of xptr (?)

Posted: Tue Sep 11, 2012 8:20 pm
by Rado1
I'm trying to call the libmodplug library from ZGE, and the following improvements could maybe help me to avoid writing a dll wrapper in C++:

- xptr for File component (used for embedded file)
- xptr used as type of global variables

I'm not really sure with these changes, but my idea is to translate the following C++ API code:

Code: Select all

struct _ModPlugFile;
typedef struct _ModPlugFile ModPlugFile; 

ModPlugFile* ModPlug_Load(const void* data, int size);
to the corresponding ZGE's external function looking like this:

Code: Select all

xptr ModPlug_Load(xptr data, int size) {}
and then call from expression:

Code: Select all

ModPlug_Load(ModFile, ModFile.Size);
ModFile is a File component. Should it work in this or similar way? Any ideas?

Posted: Tue Sep 11, 2012 8:55 pm
by darkhog
How about passing path to file and wrapper would detect size by itself? True, you'll have to store music as separate file, but it would be okay until proper solution is being made.

BTW. I think your idea of xptr is good and should be implemented, I just posted workaround for a time being.

Posted: Tue Sep 11, 2012 9:59 pm
by Rado1
darkhog wrote:How about passing path to file and wrapper would detect size by itself? True, you'll have to store music as separate file, but it would be okay until proper solution is being made.
Of course the library wrapper would provide such a functionality, but the point is, that I would like to avoid creating such a wrapper because it brings more overhead to development; even if in the case of libmodplug the wrapper will be relatively trivial.

Posted: Tue Sep 11, 2012 10:02 pm
by darkhog
I know. As I said, your solution is more clear, but for the time being, before it is implemented, this is my idea how it could work.