[SLUG] [PIG] call a function without knowing its name in C

From: Sick Twist (thesicktwist@hotmail.com)
Date: Sun May 28 2006 - 01:39:41 EDT


I'm writing a little project in C and have hit a wall. Let's say I have
Functions A, B, C, & D. How can I make A dynamically call B, C or D based on
a keyword in a text file *without* A knowing the exact names of functions B,
C or D beforehand?

Is there some trick I can do with #define, enum and function pointers? Or
perhaps some other way to go about it? The goal is to make it easy to add
new functions to the program without having to continually modify all the
functions that might call them.

Perhaps I am overly complicating things with abstraction but I am still
curious to see if it can be done.

-Jonathon

-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 19:26:21 EDT