@ in names of external functions
Posted: Tue Aug 28, 2012 5:14 pm
Hi,
today I played with SunVox which is quite an interesting tracker with modular synthesizer. It produces pretty small files and there exists also a dll which can play these files.
Unfortunately, the dll exports functions with names such as sv_init@16, sv_open_slot@4, sv_load@8, etc. If used in a C code, the dll is initialized in a header file, where pointers to all these stupid functions are loaded and stored in variables with normal names, eg., v_init, sv_open_slot, sv_load, etc. Then used in the C code normally. Of course, ZGE cannot call this header file with dll initialization.
Because the interface uses just primitive types which are called from ZGE easily, I did not want to create a dll facade; which would be in fact another dll loading/calling the original sunvox.dll. (Distributing 2 dlls with one zge file just to play music is stupid anyway.)
How is it possible to call functions with @ from ZGE? The problem is that @ is not a valid character in names. What about to extend calling external functions with something like this:
alias "exported_name" (parameters) {}
? Alias would be the name of the function in ZGE, real exported name can be omitted if identical with alias. I'm not sure it it could work... is it a stupid idea?
today I played with SunVox which is quite an interesting tracker with modular synthesizer. It produces pretty small files and there exists also a dll which can play these files.
Unfortunately, the dll exports functions with names such as sv_init@16, sv_open_slot@4, sv_load@8, etc. If used in a C code, the dll is initialized in a header file, where pointers to all these stupid functions are loaded and stored in variables with normal names, eg., v_init, sv_open_slot, sv_load, etc. Then used in the C code normally. Of course, ZGE cannot call this header file with dll initialization.
Because the interface uses just primitive types which are called from ZGE easily, I did not want to create a dll facade; which would be in fact another dll loading/calling the original sunvox.dll. (Distributing 2 dlls with one zge file just to play music is stupid anyway.)
How is it possible to call functions with @ from ZGE? The problem is that @ is not a valid character in names. What about to extend calling external functions with something like this:
alias "exported_name" (parameters) {}
? Alias would be the name of the function in ZGE, real exported name can be omitted if identical with alias. I'm not sure it it could work... is it a stupid idea?