|
Boost Users : |
From: Isaac Lascasas (pisiiki3_at_[hidden])
Date: 2008-08-17 13:09:33
That was exactly what I was looking for. I am again surprised that my needs are <again> already covered by boost in some way.
Thank you,
Isaac Lascasas.
From: Jeremy Pack
Sent: Sunday, August 17, 2008 7:03 PM
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] building and calling "dynamic c++" from a hostprogram
Isaac,
On Sun, Aug 17, 2008 at 9:27 AM, Isaac Lascasas <pisiiki3_at_[hidden]> wrote:
Hello I have the following question:
If you want to make a program that will let the user write "scripts" directly in c++, how will you do it? I am strugling my mind these days looking for a solution to this problem and I want to know if boost already address this situation. My intuition tells me that the process will probably consist on invoking bjam to build a dynamic lib with the "script" and then call the built code in the host binary. But how can this be done keeping it portable and clean? Obviously it won't work if you don't have a build environment configured but anyway it may be a very interesting feature.
Regards,
Isaac Lascasas.
That kind of depends on what exactly you want. I put an example in Boost.Extension that automatically compiles arbitrary code (using Boost.Build - but you could modify it for other compilers) into a shared library and then loads and runs it:
http://svn.boost.org/trac/boost/browser/sandbox/libs/extension/examples/runtime_compilation
I haven't gotten around to writing documentation for the example, but plan to do it in the next few weeks. The code is relatively straightforward though.
As far as a full scripting environment for C++, there are full libraries that do this - but you'd have a tough time persuading me that Python or another actual scripting language (perhaps with Boost.Python) wasn't a better solution. I guess if all you have is a hammer...
Jeremy Pack
http://boost-extension.blogspot.com
--------------------------------------------------------------------------------
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net