0

I am not sure if the title of this question gets to the point. I have written a large software system in C C++ for Windows, and want to give the users of this system the option to add compiled code to it. The user should be able to do basic stuff, and exchange data with my program.

Currently the implemented way is via DLLs. But for this, a grown up compiler is needed, and it is not as easy as I wished. Is there a tiny C compiler that can create Windows DLLs?

Another idea is the Java native interface. But this requires a complete Java system to run in the background, and it is not easy to run code in it.

Do you have any other ideas?

Rene
  • 3,746
  • 9
  • 29
  • 33
  • 3
    Sounds like an embedded language like lua, python or ruby would help. – snies Jun 27 '12 at 13:21
  • For a minimal c/c++ compiler maybe have a look at mingw. – snies Jun 27 '12 at 13:23
  • I'd go for lua. The syntax seems a lot nicer than TCL, and it is easily sandboxed. There's a decent amount of community support and example code on the web. Fast, safe, simple. – Rook Jun 27 '12 at 13:25

5 Answers5

2

Any interpreted language? (TCL and Lua were designed as extension languages, but you can nearly as easily interface with any other).

AProgrammer
  • 51,233
  • 8
  • 91
  • 143
0

How about python integration?

You could create an python interface that interfaces with your application. Python is rather easy to learn and should integrate easily with c/c++. The python documentation has an own chapter on that.

You could also use a tool like swig to generate the interface.

The advantage of this is that they wouldn't have to compile anything. They could just supply python files that could be loaded into your application and run within the software. This is a well known use for python, and something its simple syntax promotes.

daramarak
  • 6,115
  • 1
  • 31
  • 50
0

As the other says you will be best of by providing an embedded language.

I would chip in for javascript and use the google v8 engine By using javascript you get a language nearly everbody can use and program in. There is other javascript engines you can embed like SpiderMonkey. See this answer for what to choose.

Community
  • 1
  • 1
lebox
  • 56
  • 3
0

An interpreted language is not good enough. I need speed. The software itself is an interpreted language. So I added support for the tiny C compiler. It is only C, and I do check mingw, which probably would not be as tiny as this. Thanks for all your hints.

Added after several months:

I have now two tools, actually: TinyC and Python. The speed difference between those is noticable (factor 5-10), but that usually does not matter too much. Python is much easier for the user, though I managed to integrate both into the Euler GUI quite nicely.

Rene
  • 3,746
  • 9
  • 29
  • 33
0

One of the ways is to add scripting. You application can host scripting environment and expose its services there. Users would be able to execute JScript/VBScript scripts and interact with your application. The advantage is that with reasonable effort you can get the power of well known and well documented scripting languages into your application (I suppose there is even debugger for scripting there). You will be required to shape your app services as COM interfaces and scripts will be able to access them automatically using method names you assigned on C++ side.

Roman R.
  • 68,205
  • 6
  • 94
  • 158