Page 1 of 1

@ in names of external functions

Posted: Tue Aug 28, 2012 5:14 pm
by Rado1
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?

Posted: Wed Aug 29, 2012 7:02 am
by VilleK
That's a good idea, I've seen solutions like that in other languages but haven't before encountered a situation where it would be needed in ZGE.

I'll look into it but can't promise when it will be fixed. In the meantime you could also ask on their forums if they can't just make a dll with normal (unmangled) names.

Posted: Fri Aug 31, 2012 1:49 pm
by jph_wacheski
Oh that is a rather niffty tracker,. what is the licence on the .dll (.so) ? Do post if you get it working as I would give it a try,.

Posted: Fri Aug 31, 2012 5:27 pm
by Rado1
It is not necessary to solve the @ problem now - we have a version of the SunVox library with unmangled function names, see this topic for details.