Sign in to follow this  

AngelSCript not for Mac?

This topic is 4583 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well, I need some scripting language for my game and AS I liekd the most, mostly because of the ease of use and C-like syntax. But I want my game also for Macs and Linux.. and AngelScript does not support Macintosh, at least judging from the homepage. So, I wanted to verify - is AngelScript really not available for Macs?

Share this post


Link to post
Share on other sites
Version 2.1.0b (and soon 2.1.0c) doesn't work on Mac, because it has a lot of assembler instructions to be able to communicate natively with the C/C++ application.

In version 2.2.0 WIP, there is a preprocessor flag AS_MAX_PORTABILITY which can be defined during compilation of the library to turn off all these assembler instructions. This will allow you to use the library on Mac as wel., However you will only be able to use the asCALL_GENERIC calling convention, which basically means that you'll have to write a lot of wrapper functions.

To support native calling conventions on Mac I will need help to implement the assembler instructions needed. I don't have a Mac so I cannot do it myself. I know another programmer is giving it some effort, but I haven't heard from him in a while and I'm not sure that he will be able to finish it. If you are interested in giving it a try, what I need know is how the C calling convention works on Mac using your compiler. I'll also need the syntax for how to compile inline assembly using your compiler.

You may take a look at the article Calling Conventions on the x86 Platform to get some ideas on what needs to be investigated to add support for native calling conventions on the Mac.

I'd really like to add better support for Mac, but without help I cannot do more than I already have with the AS_MAX_PORTABILITY mode.

Regards,
Andreas

Share this post


Link to post
Share on other sites
HMZ, I didnt intend very advanced scripting. Most I usually would be needing - load AS script and execute from it some C functions, check result(if-s, switches..) and..well, that would be basically all - nothing more complicated than that, actually. Would I be able realise those things with AS for PC and Mac without much of additional work?

(I am kinda newbie and I am not pretty familiar with advanced programming.)

Share this post


Link to post
Share on other sites
The extra work needed for the Mac in comparison to Win32/Linux depends on how much of the application you wish to expose to the scripts. Calling script functions would work exactly the same way, the only difference is how the script library calls application registered functions. Example:

On the Win32/Linux you would be able to register the following function directly:


void Print(std::string &str)
{
printf(str.c_str());
}

engine->RegisterGlobalFunction("void Print(string &in)", asFUNCTION(Print), asCALL_CDECL);


On the Mac you would have to write a light wrapper, that the script library can communicate with:


// This is still the same function
void Print(std::string &str)
{
printf(str.c_str());
}

// The wrapper
void Print_Generic(asIScriptGeneric *gen)
{
std::string *str = gen->GetArgObject(0);
Print(*str);
}

// Register the wrapper, instead of the real function
engine->RegisterGlobalFunction("void Print(string &in)", asFUNCTION(Print_Generic), asCALL_GENERIC);


To the script writer there is no difference, and to the rest of your application there is also no difference. Only how the script library communicates with the application.

Regards,
Andreas

Share this post


Link to post
Share on other sites

This topic is 4583 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this