Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling a function as a string BCB6

Status
Not open for further replies.

T1ck

Programmer
Jan 28, 2005
6
0
0
GB
Hi,
Is there anyway to call a function by using a string?

Essentially what i want to do is to have a database that stores the path and name of a DLL, the name of a a specific function in that DLL and any required parameters for that function (inc data types etc). I then want a calling application to reference this database, pick up the DLL name, function name etc and than call that function in the DLL.

This function name and parameter list will be returned as a string so i was wondering if there is anyway to call a function by only having the function name as a string.

The only alternative that i can see would be to create a function with multiple IF statements that called predefined functions. The only problem with this is that each time a new DLL/function is added to the database, i would need to create a new IF statement and recompile.

Or maybe i'm just approaching this totally the wrong way.

Any suggestions?

Thx in advance

A Tummings
 
Since a function or DLL must be defined before the program can be compiled you have to add that to the program anyway. In other words, you have to use IF statements.

A better way you be to use executables instead of DLLs. This way you could pass the strings to a CreateProcess call and start a program.

James P. Cottingham
-----------------------------------------
[sup]To determine how long it will take to write and debug a program, take your best estimate, multiply that by two, add one, and convert to the next higher units.[/sup]
 
Thx a lot. The more i thought about it, the more i could see me having to use IF statements.

Unfortunately, i cant use executables as i'm reusing DLLs that were created by someone else so all i have is the DLL.

Thx for the confirmation though. Much appreciated
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top