Multi-target extension function names

MudbuG

Member
I am currently working on an extension that targets both Windows and HTML5 targets. In the first case, I have a c++ DLL, in the 2nd case, a javascript file. I want to call the same function in both cases. GM prevents me from using the same function name in the js extension as I did in the c++ extension.

What is the correct approach (or maybe one of the correct approaches) for accomplishing this task? With the limited information I have at hand right now, my first thought is this sort of work-around:
  • name the same function differently in each extension file
    • win_do_something
    • js_do_something
  • create an GML script, "do_something" to act as an adaptor
    • detect platform in this script and decide to call either "win_do_something" or "js_do_something"
Is there a better way?
 

MudbuG

Member
So it seems the manual covers this. The proper way is to use Proxy files. I guess it pays to read (or re-read) the manual sometimes :)
 

Cowlord

Member
I totally forgot you can have multiple configurations in one project. Checking the OS and slight change in variable name was the first solution that came to me while reading.
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
If you add functions externally, you can have overlapping function names just fine - so long as each extension file has it's own target platforms.
 
Top