Re: A simple cast.
From: Doron Holan [MS] (doronh_at_nospam.microsoft.com)
Date: 02/26/04
- Next message: Phil Barila: "Re: Writing a correct MBRfrom User Mode"
- Previous message: Kirk Ferdmann: "Re: System power mode"
- In reply to: J.P. Iribarren: "Re: A simple cast."
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 25 Feb 2004 22:26:59 -0800
yes, you can always take the address of a function. the question is whether
you can cast it to PVOID or only store it under the correct pointer type
-- This posting is provided "AS IS" with no warranties, and confers no rights. Please reply to newsgroups only. "J.P. Iribarren" <famirib33@free.fr> wrote in message news:c1hpia$me5$1@s1.read.news.oleane.net... > I. Omega wrote: > > if I want to print the address of on integer, for example, I can just > > use: > > fprintf( exportFile, "Address: %i\n", &m_iMyInt ); > > > > I need to print the address of a long function. > > I have a class MyClass, and I have instantiated it in the variable > > mySuperClass. > > > > MyClass mySuperClass = new MyClass(); > > > > Now I have a long function: > > > > long MyClass::CoolFunction( int thisInt, byte byteArray[], float > > thisFloat ); > > > > So, how do I find the address of this function? > > > > mySuperClass->CoolFunction( anInt, aByteArray, aFloat ); > > Okay, I can call it like this, but what kind of cast can I use to > > determine its address and export with frpintf? > > I hope I'm not misleading you, but as far as I can tell, provided > CoolFunction *is not virtual*, you can use the following syntax... > > &MyClass::CoolFunction > > ... to get the address of CoolFunction. > > For further info, search MSDN and/or Google Groups for "C2276", which is > the compiler error you get when you try to use the address of a virtual > function. > > HTH, > -- > Jean-Paul Iribarren (aka JPI) > Anti-spam: ma véritable adresse électronique ne comporte pas de > chiffres;donc... > Anti-spam: my real e-mail address has no digits; consequently... >
- Next message: Phil Barila: "Re: Writing a correct MBRfrom User Mode"
- Previous message: Kirk Ferdmann: "Re: System power mode"
- In reply to: J.P. Iribarren: "Re: A simple cast."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|