C function call dynamically


 
Thread Tools Search this Thread
Top Forums Programming C function call dynamically
# 15  
Old 12-18-2009
Quote:
Originally Posted by pogdorica
Hi.

I need help with a C/C++ question and i hope someone can help me or give me some ideas.

Is possible to build a function C/C++ call dynamically? I.e, i have an array with pointer functions and these functions can have different number of parameters and types. These parameters and their types are stored in a database that i'll get depending on the function name that i want to execute with a function pointer.

More or less i want to build a function thrower with any parameter.

Can i build the function call dynamically?

Any idea?
Hello
you can also implement virtual function in C++.
you give some definition of function in the base class and declare it virtual and then give another defintion with/without the same signature in the child class.
This excludes static binding and the function relevant to the data would be called dynamically at runtime. But it does seem a litttle bloated.
I would have a look at the C++ reflection library . Seems interesting though.
Regards.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

How to Dynamically Pass Parameter to plsql Function & Capture its Output Value in a Shell Variable?

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: 2. Relevant commands, code, scripts, algorithms: #! /bin/ksh v="ORG_ID" ... (2 Replies)
Discussion started by: sujitdas2104
2 Replies

2. Shell Programming and Scripting

How to dynamically name as function in shell?

Hi all, Does anyone know if it possible to append a parameter to a function name? Something like the following: function tnsrec_${SERVICE_NAME} { code.. } Any ideas? (6 Replies)
Discussion started by: jonnyd
6 Replies

3. Shell Programming and Scripting

After exit from function it should not call other function

Below is my script that is function properly per my conditions but I am facing one problem here that is when one function fails then Iy should not check other functions but it calls the other function too So anyone can help me how could i achieve this? iNOUT i AM GIVING TO THE... (1 Reply)
Discussion started by: rohit22hamirpur
1 Replies

4. Shell Programming and Scripting

Function call

Hi foiks i am unable to find what is wrong in my code mu functionality is to exit from shell when i give 99 but it is not calling function ext Could you please correct me. read option if ; then ext else echo "out" fi function ext { echo "tested 99 and exit... (12 Replies)
Discussion started by: kojo
12 Replies

5. Infrastructure Monitoring

diffrence between method call and function call in perl

Hello, I have a problem with package and name space. require "/Mehran/DSGateEngineLib/general.pl"; use strict; sub System_Status_Main_Service_Status_Intrusion_Prevention { my %idpstatus; my @result; &General_ReadHash("/var/dsg/idp/settings",\%idpstatus); #print... (4 Replies)
Discussion started by: Zaxon
4 Replies

6. Shell Programming and Scripting

Function Call

How we can start a process if doesn't exists before? (1 Reply)
Discussion started by: Zaxon
1 Replies

7. Shell Programming and Scripting

help on function call

hello, when i call function inside awk traitement it doesn't work, i don't have error execution but i don't get result and if i call the function outside awk traitement it work well.. there's something special in awk call function?? here is the example : awk -F "," '{ {first=$1; sec=$2;... (3 Replies)
Discussion started by: kamel.seg
3 Replies

8. Shell Programming and Scripting

call function

I have a function check_ok in my abc.sh. which return me 1 or 0 . I want to call this fuction through other shell script. this shell also send two parameter to calling function. Can you please tell me how. I am very new in unix. #!/bin/bash date_equal() { sqlplus -silent... (4 Replies)
Discussion started by: Jamil Qadir
4 Replies

9. Programming

Help with a function call

Hi, Can anyone help me figure out the problem I'm having with a function call? I have a header file, which sets an enum: typedef enum {INFO, WARNING, FATAL} Levels; int log_event (Levels, char *fmt, ...); ..then the function is called this way: log_event(INFO, "Message text"); ... (6 Replies)
Discussion started by: Stevhp
6 Replies

10. Shell Programming and Scripting

function call

can I call a function in bash script just as in C++ while do function() done function() thanks, Steffen (3 Replies)
Discussion started by: forever_49ers
3 Replies
Login or Register to Ask a Question
dlmodadd(3C)															      dlmodadd(3C)

NAME
dlmodadd() - register information about dynamically generated functions SYNOPSIS
[flag]... file... [library]... DESCRIPTION
registers information about a dynamically generated function, which can be retrived through The interface can be used to remove the regis- tered information. associate_handle is the module handle for an existing module with which the new function is associated. When the dynamic loader is called from the new function, it will behave as if it had been called from the associated module. This handle must be a handle returned by or func_start is the starting address of the generated machine code for the function. It is NOT the address of a function descriptor. func_size is the size, in bytes, of the generated machine code. linkage_ptr is the gp (global pointer) value to be used for the function. It could be the gp of the associated module. It must be set to a valid value, even if the generated code doesn't actually use gp, as it is required at a minimum for following the personality routine pointer in the unwind information. unwind_info is a pointer to the beginning of the unwind info block for the function. The unwind info block contains the header word, unwind descriptors, personality routine pointer, and language-specific data, as described in the Itanium-based system document. When is invoked to register information about a dynamically generated function, the dynamic loader creates an unwind header and a single- entry unwind table for the function. The unwind header is associated with the address range occupied by the dynamically generated func- tion. The routine returns a handle as identification of the newly-added function. Handles returned by share the same namespace as handles returned by and but they may not be used in calls to or If is called with an ip_value that belongs to a function that has been registered with it returns the associate_handle specified during invocation. If a library is unloaded by the unwind info for all dynamically generated functions associated with the library being unloaded is also removed. MULTITHREAD USAGE
This routine is thread-safe. RETURN VALUE
If successful, returns a handle as identification of the newly-added function. NULL is returned otherwise. ERRORS
If fails, a subsequent call to returns one of the following values: Out of memory. Cannot apply relocation in library. failed on entry to failed on exit from Invalid argument . failed on entry to or exit from AUTHOR
was developed by HP. SEE ALSO
ld(1), dlclose(3C), dlerrno(3C), dlerror(3C), dlget(3C), dlmodremove(3C), dlopen(3C), dlsym(3C), a.out(4), dld.so(5). Texts and Tutorials (See the option) (See manuals(5) for ordering information) dlmodadd(3C)