typedef void(* ptr)(argumentlist)问题

时间:2009-06-02 06:02:12

标签: visual-c++

如何向/从此函数指针传递或获取参数值:

typedef void(*  CreateCursorBitmapProc )(uchar *bitmapBuffer, uint32 *width, uint32 *height, bool16 *hasAlpha) 

bitmapBuffer,width,height,hasalpha是out参数。

1 个答案:

答案 0 :(得分:2)

// Grab an instance from somewhere...
CreateCursorBitmapProc instance = ...;

// Declare output variables
// should be initialized to some buffer, probably
uchar *bitmapBuffer = new uchar[size_of_buffer]; 
uint32 width, height;
bool16 hasAlpha;
(*instance)(bitmapBuffer, &width, &height, &hasAlpha);