• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Any way to use C/C++ code with GM:Studio v1.4 or v2??

P

Poking Pug

Guest
Hi!

Basically the question is self-explanatory: GM:S has been using its proprietary language from the beginning, which has changed a bit over the years, but it's clear that it is not using regular C/C++/JavaScript/Delphi/etc. syntax, it's a mix of them with some personal touches. All I want to know is if there's any easy way to externalize some code/scripts using native C/C++ code. And here I include anything from simple things like functions to more complex ones such as using pointers, templates, classes, etc.

In short: any way to use native C/C++ in GM:S?!?! Thank you!!!
 

chamaeleon

Member
Only by creating extensions suitable for the target platform (dlls using C/C++ for Windows, Javascript for HTML5, Java Jar for Android, etc.) that exposes functions to call from GMS. It doesn't make it possible to write in these languages inside GMS if that is what you're looking for.
 
P

Poking Pug

Guest
Well basically I want to be able to write pieces of code in native C/C++ that can be directly linked to the rest of GML. So for example I'd want to create a function in C and call it from GML, use its return value, etc. and I do not want to use platform-specific extensions, because this has nothing to do with the OS you're running on unless you target system-specific things. But writing a function in C/C++ is the most open-platform thing you could possibly do, so I was wondering if we can at least do something as basic as this with the new GM:S v1.4 or v2. Note that I've been developing with GameMaker since v4.1, then v5.3a, v6 and 7, skipped 8 and only played a bit with Studio, so I just wanted to know if something was done in this matter over the last few installments. Thank you!!!
 

Mick

Member
The only way to use C/C++ in GMS is through native extensions. The functions will be "linked" to GML like you want, you can even send buffer pointers to the extension and directly manipulate the buffers in the extension. However, you need to build the extension for the platforms you want to use it on. I have successfully made a few C/C++ extensions that work on Windows, Linux, OS X and Android using the same codebase. The problematic platform is Android, but I made a tutorial for that (in the tutorials section of this forum). I haven't tried to build any extension for IOS, because I haven't had the energy to go through all seven levels o hell to build anything for IOS.
 
P

Poking Pug

Guest
So C/C++ extension should be easier, right? BTW: what you said still applies identically for v2? Or you haven't tried yet? Thanks!!!
 

Mick

Member
Top