Function prototyping at runtime

P

Philliam Auriemma

Hey guys,
Is it possible to do function prototypes at runtime based on user
input for instance?

If you have something like this:

typedef void (*a)(int);

and after it

void (*aFunction)(int);

hardcoded in the program, could you do something equivalent to this at
runtime?
 
Ö

Öö Tiib

Hey guys,
Is it possible to do function prototypes at runtime based on user
input for instance?

If you have something like this:

typedef void (*a)(int);

and after it

void (*aFunction)(int);

hardcoded in the program, could you do something equivalent to this at
runtime?

In C++ you can not since it is compiled and not interpreted language.

However you can (with some labor invested) to implement an interpreter
or (with less labor invested) to embed some existing interpreter into
your C++ program.

Most interpreters have measures to interface with (dynamically
loadable) libraries written in C or C++ and usually it is possible to
describe prototypes to functions in such library that you plan to call
with your script run time.
 

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

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top