Click here to Skip to main content
15,846,091 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Function pointer Pin
Richard MacCutchan21-Mar-13 1:51
mveRichard MacCutchan21-Mar-13 1:51 
GeneralRe: Function pointer Pin
Marco Bertschi21-Mar-13 2:06
protectorMarco Bertschi21-Mar-13 2:06 
GeneralRe: Function pointer Pin
Richard Andrew x6421-Mar-13 2:57
professionalRichard Andrew x6421-Mar-13 2:57 
GeneralRe: Function pointer Pin
Marco Bertschi21-Mar-13 3:16
protectorMarco Bertschi21-Mar-13 3:16 
GeneralRe: Function pointer Pin
Freak3021-Mar-13 3:30
Freak3021-Mar-13 3:30 
GeneralRe: Function pointer Pin
Marco Bertschi21-Mar-13 3:36
protectorMarco Bertschi21-Mar-13 3:36 
GeneralRe: Function pointer Pin
dusty_dex21-Mar-13 5:21
dusty_dex21-Mar-13 5:21 
GeneralRe: Function pointer Pin
Richard MacCutchan21-Mar-13 4:28
mveRichard MacCutchan21-Mar-13 4:28 
Yes you could do that (you need int (*DoTaks)(void*); notation), but you still have the problem that any mistakes with the parameters cannot be spotted by the compiler. If you are happy to live with that risk then go ahead; a small prototype should help to clarify the issues you may face. Something like:
C++
struct aStruct
{
    int value;
    char someText[12];
};

int func1(int pvParameters[3])
{
    // do something with the parameters
    return 1;
}

int func2(aStruct* paStruct)
{
    // do something with the parameters
    return 2;
}

void DoTest()
{
    int myArray[] = { 1, 2, 3 };
    aStruct myStruct = { 5, "data" };

    int (*DoFunc)(void*);
    
    DoFunc = (int (*)(void*))func1;
    int r = DoFunc((void*)myArray);
    
    DoFunc = (int (*)(void*))func2;
    int r2 = DoFunc((void*)&myStruct);
    
}

Use the best guess

QuestionProblem regarding to array in C++ Pin
achylast20-Mar-13 23:00
achylast20-Mar-13 23:00 
AnswerRe: Problem regarding to array in C++ Pin
Richard MacCutchan20-Mar-13 23:48
mveRichard MacCutchan20-Mar-13 23:48 
QuestionRe: Problem regarding to array in C++ Pin
achylast25-Mar-13 16:36
achylast25-Mar-13 16:36 
AnswerRe: Problem regarding to array in C++ Pin
Richard MacCutchan26-Mar-13 0:31
mveRichard MacCutchan26-Mar-13 0:31 
AnswerRe: Problem regarding to array in C++ Pin
Marco Bertschi21-Mar-13 1:12
protectorMarco Bertschi21-Mar-13 1:12 
QuestionWinsock Error 10035 Pin
john563220-Mar-13 20:26
john563220-Mar-13 20:26 
AnswerRe: Winsock Error 10035 Pin
Jochen Arndt20-Mar-13 23:09
professionalJochen Arndt20-Mar-13 23:09 
GeneralRe: Winsock Error 10035 Pin
john563220-Mar-13 23:43
john563220-Mar-13 23:43 
GeneralRe: Winsock Error 10035 Pin
Jochen Arndt21-Mar-13 0:03
professionalJochen Arndt21-Mar-13 0:03 
QuestionDirectShow is a flop – any other video library out there? Pin
Vaclav_20-Mar-13 18:06
Vaclav_20-Mar-13 18:06 
AnswerRe: DirectShow is a flop – any other video library out there? Pin
SoMad20-Mar-13 20:04
professionalSoMad20-Mar-13 20:04 
GeneralRe: DirectShow is a flop – any other video library out there? Pin
Vaclav_21-Mar-13 5:31
Vaclav_21-Mar-13 5:31 
GeneralRe: DirectShow is a flop – any other video library out there? Pin
SoMad21-Mar-13 14:06
professionalSoMad21-Mar-13 14:06 
GeneralRe: DirectShow is a flop – any other video library out there? Pin
Vaclav_21-Mar-13 16:12
Vaclav_21-Mar-13 16:12 
GeneralRe: DirectShow is a flop – any other video library out there? Pin
SoMad21-Mar-13 18:58
professionalSoMad21-Mar-13 18:58 
GeneralRe: DirectShow is a flop – any other video library out there? Pin
Vaclav_22-Mar-13 5:23
Vaclav_22-Mar-13 5:23 
AnswerSOLVED DirectShow is a flop – any other video library out there? Pin
Vaclav_21-Mar-13 11:20
Vaclav_21-Mar-13 11:20 

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.