Loading dynamic code into C++?

B

BCC

Hi,

Is there any way in c++ to load and execute code from a file,
integrating it into the original application?

I suppose this might be like dynamic classes, except that I would want
to be able to load in flow control statements, commands, variables, etc.

Thanks,
B
 
V

Victor Bazarov

[answering in comp.lang.c++]
Is there any way in c++ to load and execute code from a file,
integrating it into the original application?

No, not portably. However, if you are asking, you must have heard of it,
so there is probably a way on your platform. You need to ask in
a newsgroup for your OS or compiler.
I suppose this might be like dynamic classes, except that I would want
to be able to load in flow control statements, commands, variables, etc.

Are you talking about *interpreters*? Then there are those on the market.
Just google for them.

V
 
B

BCC

Victor said:
Are you talking about *interpreters*? Then there are those on the market.
Just google for them.

V

Hmm, possibly, if such an interpreter could be bundled into an existing
application. The goal would be for my app to interpret (so interpreter
sounds good) c++ code from a flat file and execute it.

Maybe there are some interpreters that can be loaded via static libs or
dlls? Ill take a look, thanks for the tip.

B
 
B

BCC

Victor said:
Are you talking about *interpreters*? Then there are those on the market.
Just google for them.

V

Hmm, possibly, if such an interpreter could be bundled into an existing
application. The goal would be for my app to interpret (so interpreter
sounds good) c++ code from a flat file and execute it.

Maybe there are some interpreters that can be loaded via static libs or
dlls? Ill take a look, thanks for the tip.

B
 
B

BCC

Victor said:
Are you talking about *interpreters*? Then there are those on the market.
Just google for them.

V

Hmm, possibly, if such an interpreter could be bundled into an existing
application. The goal would be for my app to interpret (so interpreter
sounds good) c++ code from a flat file and execute it.

Maybe there are some interpreters that can be loaded via static libs or
dlls? Ill take a look, thanks for the tip.

B
 
B

BCC

BCC said:
Hmm, possibly, if such an interpreter could be bundled into an existing
application. The goal would be for my app to interpret (so interpreter
sounds good) c++ code from a flat file and execute it.

Maybe there are some interpreters that can be loaded via static libs or
dlls? Ill take a look, thanks for the tip.

B

Lame. Sorry about the multi reply...
 
I

Ioannis Vranos

BCC said:
Hi,

Is there any way in c++ to load and execute code from a file,
integrating it into the original application?

I suppose this might be like dynamic classes, except that I would want
to be able to load in flow control statements, commands, variables, etc.


Are you asking about something like Windows dlls?
 
C

Cy Edmunds

BCC said:
Lame. Sorry about the multi reply...

I know this suggestion doesn't quite meet your stated requirements, but
Python can be embedded in a C++ program. Of course then you would be
interpreting Python rather than C++ but they are at least superficially
similar and Python was made to be interpreted.
 
O

one2001boy

BCC said:
Hmm, possibly, if such an interpreter could be bundled into an existing
application. The goal would be for my app to interpret (so interpreter
sounds good) c++ code from a flat file and execute it.

Maybe there are some interpreters that can be loaded via static libs or
dlls? Ill take a look, thanks for the tip.

There is a C/C++ interperter Ch, it is embeddable. You can load C/C++
code/scripts dynamically.

You can check it at:

http://www.softintegration.com/support/faq/embed.html
 
H

hibiki

BCC a écrit :
Hi,

Is there any way in c++ to load and execute code from a file,
integrating it into the original application?

I suppose this might be like dynamic classes, except that I would want
to be able to load in flow control statements, commands, variables, etc.

Thanks,
B

You need to make a dynamically loaded library (dl). Here is the link you
can browse in order to do the following :
http://www.faqs.org/docs/Linux-HOWTO/Program-Library-HOWTO.html

--
Salutations,

Joachim Naulet

06 14 90 06 21
http://jnaulet.no-ip.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top