Discussion Forum

Virtual Function pointers

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
Jim Plouffe
Posted
7-Jan-2011 12:30 GMT
Toolset
C51
New! Virtual Function pointers

I would like to define something like a virtual function pointer that would be filled in at link time and then have routines call the function if it has been defined. I am using uvision3 IDE.
Anybody have any thoughts on this (other than to tell me to use C++, C# etc.)?

Read-Only
Author
Andrew Neil
Posted
7-Jan-2011 12:40 GMT
Toolset
C51
New! RE: Anybody have any thoughts on this ?

Yes: you need to be very sure that you fully understand all the implications and limitations of function pointers in C51 before you proceed with this!

You will need to spend at least a day studying this application note: http://www.keil.com/appnotes/docs/apnt_129.asp

And at least a further day searching the Keil site for "function pointer" and studying all the material that you find...

Why do you particularly want to do this on an 8051?

Read-Only
Author
Andrew Neil
Posted
7-Jan-2011 12:45 GMT
Toolset
C51
New! use C++, C# etc !

For C++, see: http://www.8052.com/forum/read/180466

You obviously (well, I hope it's obvious) can't use C# on an 8051!

Read-Only
Author
Jim Plouffe
Posted
7-Jan-2011 12:50 GMT
Toolset
C51
New! RE: Anybody have any thoughts on this ?

Andrew, thank you for this information.
We currently have a simulation task that was specific for earlier testing but I would like to introduce a way for individual projects to tailor their test conditions instead of modifying the original code for each project.

Next Thread | Thread List | Previous Thread Start a Thread | Settings