Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which scripting language is better for embedding in multi-threaded C/C++ application [closed]

Considering the following requirementes:

  • Must be supported on Windows. Preferably works also on other platforms.
  • Must support multi threading. By that I mean that the engine can work in parallel in multiple threads.
  • Readability is important.
  • License must be compatible with closed-source projects.

I like Python for its readablity. I am also have more experience with Python than other scripting languages. However CPython is not multi-threaded, and IronPython requires hosting the CLR and a compatible language (C++/CLI or C#).

like image 936
John Avatar asked Jan 21 '11 07:01

John


People also ask

Which language is best for multithreading?

C/C++ Languages Now Include Multithreading Libraries Moving from single-threaded programs to multithreaded increases complexity. Programming languages, such as C and C++, have evolved to make it easier to use multiple threads and handle this complexity. Both C and C++ now include threading libraries.

Which scripting language is best?

The Best Scripting Languages To KnowPHP: PHP is an open-source scripting language that is frequently used in back-end web development. Python: Python is known for its concise syntax. It requires less typing than many other languages. Ruby: Ruby is one of the easiest scripting languages to learn.

What is an embedded scripting language?

An embedded scripting language would be a scripting language (or more specifically an interpreter for such a language) that can be embedded into applications. Thus, the interpreter has an API that can be used to integrate it into the application, allowing scripts to control all or parts of the application.

Is C good for scripting?

As a middle-level language, C combines the features of both high-level and low-level languages. It can be used for low-level programming, such as scripting for drivers and kernels and it also supports functions of high-level programming languages, such as scripting for software applications etc.


2 Answers

Lua might be worth checking out. It can be used in a thread-safe manner, and the language supports a 'co-routine' concept which might fit your requirements.

like image 165
Paul Dixon Avatar answered Sep 17 '22 15:09

Paul Dixon


Lua is the best choice. Python, Ruby and JavaScript are big languages and they are not designed for to embed. But Lua is different, designed to embed.

You should consider the "restriction" more than any other things for your script language. Embed scripts can use for hack (bad meaning) easily.

For example, by default Lua can not print to console. As I know, Blizzard uses the Lua because of that.

like image 44
Uordek Avatar answered Sep 20 '22 15:09

Uordek