Loading dynamic code into C++?

Discussion in 'C++' started by BCC, Apr 5, 2005.

  1. BCC

    BCC Guest

    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
     
    BCC, Apr 5, 2005
    #1
    1. Advertising

  2. [answering in comp.lang.c++]

    BCC wrote:
    > 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
     
    Victor Bazarov, Apr 5, 2005
    #2
    1. Advertising

  3. BCC

    BCC Guest

    Victor Bazarov wrote:

    >
    >> 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


    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
     
    BCC, Apr 5, 2005
    #3
  4. BCC

    BCC Guest

    Victor Bazarov wrote:

    >
    >> 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


    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
     
    BCC, Apr 5, 2005
    #4
  5. BCC

    BCC Guest

    Victor Bazarov wrote:

    >
    >> 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


    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
     
    BCC, Apr 5, 2005
    #5
  6. BCC

    BCC Guest

    BCC wrote:
    > Victor Bazarov wrote:
    >
    >>
    >>> 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

    >
    >
    > 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...
     
    BCC, Apr 5, 2005
    #6
  7. BCC wrote:

    > 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?



    --
    Ioannis Vranos

    http://www23.brinkster.com/noicys
     
    Ioannis Vranos, Apr 5, 2005
    #7
  8. BCC

    Cy Edmunds Guest

    "BCC" <> wrote in message
    news:DzE4e.17797$...
    > BCC wrote:
    >> Victor Bazarov wrote:
    >>
    >>>
    >>>> 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

    >>
    >>
    >> 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 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.

    --
    Cy
    http://home.rochester.rr.com/cyhome/
     
    Cy Edmunds, Apr 6, 2005
    #8
  9. BCC

    Guest

    BCC wrote:
    > Victor Bazarov wrote:
    >
    >>
    >>> 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

    >
    >
    > 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


    >
    > B
     
    , Apr 9, 2005
    #9
  10. BCC

    hibiki Guest

    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
     
    hibiki, Apr 11, 2005
    #10
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?V291dGVy?=
    Replies:
    1
    Views:
    692
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    Feb 25, 2006
  2. John Perks and Sarah Mount
    Replies:
    1
    Views:
    359
    Paul Clinch
    Apr 8, 2005
  3. David Segall
    Replies:
    2
    Views:
    440
    Thomas Kellerer
    Jan 2, 2007
  4. nakisa
    Replies:
    3
    Views:
    330
    Peter Otten
    Oct 18, 2010
  5. neilc
    Replies:
    84
    Views:
    782
    Jorge
    Jul 18, 2009
Loading...

Share This Page