Click here to Skip to main content
15,894,180 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: returning by reference and polymorphism Pin
Iain Clarke, Warrior Programmer10-Sep-09 9:49
Iain Clarke, Warrior Programmer10-Sep-09 9:49 
AnswerRe: returning by reference and polymorphism Pin
CPallini10-Sep-09 9:59
mveCPallini10-Sep-09 9:59 
GeneralRe: returning by reference and polymorphism Pin
paolosh10-Sep-09 11:35
paolosh10-Sep-09 11:35 
Questiontic tac toe Pin
sam_200910-Sep-09 5:18
sam_200910-Sep-09 5:18 
QuestionRe: tic tac toe Pin
David Crow10-Sep-09 5:20
David Crow10-Sep-09 5:20 
AnswerRe: tic tac toe Pin
PIEBALDconsult10-Sep-09 5:58
mvePIEBALDconsult10-Sep-09 5:58 
AnswerRe: tic tac toe Pin
Keith Barrow10-Sep-09 5:26
professionalKeith Barrow10-Sep-09 5:26 
GeneralRe: tic tac toe Pin
Selvam R10-Sep-09 7:29
professionalSelvam R10-Sep-09 7:29 
AnswerRe: tic tac toe Pin
Richard MacCutchan10-Sep-09 7:34
mveRichard MacCutchan10-Sep-09 7:34 
AnswerWrong forum. Pin
CPallini10-Sep-09 8:31
mveCPallini10-Sep-09 8:31 
GeneralRe: Wrong forum. Pin
EliottA10-Sep-09 8:33
EliottA10-Sep-09 8:33 
AnswerRe: tic tac toe Pin
jinjiashan10-Sep-09 16:49
jinjiashan10-Sep-09 16:49 
QuestionCreating a Time Provider in C++ Pin
bijumanjeri10-Sep-09 5:11
bijumanjeri10-Sep-09 5:11 
AnswerRe: Creating a Time Provider in C++ Pin
David Crow10-Sep-09 5:18
David Crow10-Sep-09 5:18 
GeneralRe: Creating a Time Provider in C++ Pin
bijumanjeri10-Sep-09 5:30
bijumanjeri10-Sep-09 5:30 
GeneralRe: Creating a Time Provider in C++ Pin
David Crow10-Sep-09 5:42
David Crow10-Sep-09 5:42 
GeneralRe: Creating a Time Provider in C++ Pin
bijumanjeri10-Sep-09 5:50
bijumanjeri10-Sep-09 5:50 
AnswerRe: Creating a Time Provider in C++ Pin
Randor 10-Sep-09 6:02
professional Randor 10-Sep-09 6:02 
GeneralRe: Creating a Time Provider in C++ Pin
bijumanjeri10-Sep-09 18:31
bijumanjeri10-Sep-09 18:31 
QuestionUsing void* to keep track of an external object. Pin
RedSonja10-Sep-09 4:15
RedSonja10-Sep-09 4:15 
Here is a void* problem to challenge you. I have a very large application A. Sometimes it needs to use a little application B. B instantiates an external dll I didn't write, we can call it G. B uses DllExport to export some functions I can call with DllImport. Whenever I call B it makes a new G and deletes it again. Fine.

Now they changed the rules. I can only have one G. Easy, I think. Add an Init function to B's external interface, call it to instantiate my single instance of G. Return a void* to B, so whenever I want to call it it reuses the instance of B and thus of G. A is not allowed to know what happens in B, so the void* is perfect. I keep void* mPointerToB as a member of A.

B has some internal classes, we can call one ClassM. So B contains a member ClassM mM. When I hop into B it runs for a while until it tries to call mM.function. Then I get a buffer overrun.

So I googled and found this statement. "A void pointer cannot point to a class member in C++." Is my void pointer to B losing its internal objects along the way? Where can I find out more? Am I doing this in the wrong way?

This is C++ in Visual Studio 2008. I use void* in other places to access pointers to things in Ada functions in the same way, so it should work, I think.

-------------
Ave computer! Hackitura te salutat!
(I just made this up. Just to show you can hack Latin as well as C++.)

AnswerRe: Using void* to keep track of an external object. Pin
Richard MacCutchan10-Sep-09 7:43
mveRichard MacCutchan10-Sep-09 7:43 
GeneralRe: Using void* to keep track of an external object. Pin
RedSonja10-Sep-09 20:50
RedSonja10-Sep-09 20:50 
GeneralRe: Using void* to keep track of an external object. Pin
Richard MacCutchan11-Sep-09 1:19
mveRichard MacCutchan11-Sep-09 1:19 
GeneralRe: Using void* to keep track of an external object. Pin
RedSonja17-Sep-09 20:41
RedSonja17-Sep-09 20:41 
QuestionSerial port behaviour in XP and windows 2000 Pin
sunny_vc10-Sep-09 2:50
sunny_vc10-Sep-09 2:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.