Free scripting library?

This is a discussion on Free scripting library? within the Windows Programming forums, part of the Platform Specific Boards category; Hi...
I'm making an app that needs some sort of scripting support so the user can write their own custom ...

Free scripting library?

Hi...
I'm making an app that needs some sort of scripting support so the user can write their own custom scripts for it.

Does anybody know of a good scripting library, preferably using a C/C++ style language (if not C/C++ please tell me anyway, its just that C/C++ style is my personal favourite ) that would be possible to use under windows with MSVC++6?

Re: Free scripting library?

Originally posted by PsychoBrat Hi...
I'm making an app that needs some sort of scripting support so the user can write their own custom scripts for it.

Does anybody know of a good scripting library, preferably using a C/C++ style language (if not C/C++ please tell me anyway, its just that C/C++ style is my personal favourite ) that would be possible to use under windows with MSVC++6?

Thanks,
Jeff

I do shell scripting under Windows with JScript.....its like JavaScript and uses Windows Scripting Host...it can access ActiveX too...

Originally posted by PsychoBrat but how could I use this in my app... and share certain variables/functions in my app for the user to call in his/her scripts?

That's where it gets nasty....usually the old way to share info with scripts is by the return value from main......not very decent info!!

These scripts as I said can use COM.....so if you want to share data between scripts, you should look at using a COM object to interface between your app and the script...

I do very little COM, but when I do I use ATL (comes with VC++6 and is like an MFC for COM). You use this tool to create a dll and add classes to it that your script can communicate with / pass data / recieve data...etc. Also, its a bit more difficult to get COM to work with scripts (as it uses a special interface called a dispatch interface) but ATL does all the work for you

Its a lot of work to understand and needs some reading on your part.....but to give you a taste, here's a basic COM object I wrote this morning to give the same functionality as my above script (I have attached the VC++ project files. Open the PoorDate.dsw file to open VC++ and click build. The dll produced houses the COM object).

When the dll is build, go to the debug dir (where you will find the actual dll) and save the following as Reg.bat

Code:

regsvr32 poordate.dll

Now double click the file and windows will register your dll to be used as a com object on the system.

Now create the following script as Test.js (like my previous one - but more personal!).