Jump to content
  • Advertisement
Sign in to follow this  
aayudh

automatic linking for scripting language

This topic is 2852 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

Ok this is probably stupid..

I want to call c++ functions from my scripting language. I know you can do binding similar to luabind etc. .. but what I want is it to be automatic.

Can someone suggest some ideas as how I can link to functions lets say in a dll ?

Thanks,
Madan

Share this post


Link to post
Share on other sites
Advertisement
one idea is that I can have my game dll import these function calling in scripting language and recompile the game dll.

But this is retarded since the point of scripting language will be defeated.

Share this post


Link to post
Share on other sites
There has to be a binding layer -- there's no way around it. The best you can do is make it easy and perhaps make tools to simplify things even more. Lua is in large part so popular because it is known for being simple to bind with.

If you want your script to be able to call into compiled code and vice versa with no binding layer, then you're really talking about creating a compiled programming language, rather than a scripting language. Even different languages have to be "bound" in a manner of speaking, because each language adheres to different rules about how parameters are passed (whether by reference or by value, or both, whether in registers or on the stack), how return values are yielded back, how exceptions work, how composite data types like classes/structs/unions are organized, how names are mangled... Even calling between vanilla C and C++ binaries is not directly compatible (even though C++ is essentially backwards compatible in source code), which is why you have to use 'extern "C"' when you expose C++ methods to C code.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!