|
|
|
|
![]() ![]() |
Jan 25 2005, 07:16 AM
Post
#1
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 351 Joined: 19-October 04 From: India Member No.: 1,824 |
hi everyone,
here is an exercise for u... I found it quite interesting... hope u like it too.... The question is : How do you call a function, given its name as a string? Try it out and post the solution/example.... or post ur approach to the sol... a hint: the solution is not very difficult... I will post the solution next week.... cya, keep trying... All the best. Cheers. |
|
|
|
Jan 25 2005, 10:31 AM
Post
#2
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 114 Joined: 9-August 04 From: Suzhou Jiangsu China Member No.: 743 |
QUOTE(cse-icons @ Jan 25 2005, 07:16 AM) hi everyone, here is an exercise for u... I found it quite interesting... hope u like it too.... The question is : How do you call a function, given its name as a string? Try it out and post the solution/example.... or post ur approach to the sol... a hint: the solution is not very difficult... I will post the solution next week.... cya, keep trying... All the best. Cheers. You may try something like function pointer. I have an article about this: http://www.trap17.com/forums/trap17-file-no-833.html modify it to fit your use. |
|
|
|
Jan 26 2005, 04:45 AM
Post
#3
|
|
|
Engineer ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 78 Joined: 25-July 04 From: China Member No.: 204 |
Oh, I have interest in this question.
trap17-file-no-833.html is somewhat too simple and means nothing. Vxworks do this way very well, but I still don't know how it works. Waiting for your solution. |
|
|
|
Jan 26 2005, 05:07 AM
Post
#4
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 408 Joined: 7-December 04 From: Nova Scoita, Canada Member No.: 2,604 |
I know with dynamically linked libraries you can get a function reference by passing a string that contains the function name. So you just compile the functions as a DLL it will work.
|
|
|
|
Jan 26 2005, 04:06 PM
Post
#5
|
|
|
Engineer ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 78 Joined: 25-July 04 From: China Member No.: 204 |
but params,
how to give the correct params? like: func("asdf",1) QUOTE(s243a @ Jan 26 2005, 05:07 AM)
|
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 6th October 2008 - 11:47 PM |