From: John B. <joh...@ho...> - 2003-02-18 01:55:49
|
>>Can some one help me out also by explaining what that >>weird structure of >> >>typedef void (*hello_t)(); >> >>or what i did is ! > >I'm not sure what you are asking here. > Your original definition was: typedef unsigned long (*hello_t)(int iDevice,unsigned long *ftHandle); What you are doing here is creating a function pointer type for a function with the following prototype: unsigned long MyFunction(int iDevice, unsigned long *ftHandle); I don't completely understand all aspects of the syntax, but I know how to use it. 1)It follows the usual typedef rules, e.g., int x; //definition of int variable named x typedef int x; // definition of int type named x so putting hello_t where the function name was, declares a function pointer type with the name hello_t. 2) You have to put *hello_t. typedef unsigned long (hello_t)(int iDevice,unsigned long *ftHandle); will compile, and you will be able to define hello_t h; but h = GetProcAddress(...) will fail because h is not an lvalue. I don't know what h would be in this case. 3) The *hello_t has to be in parentheses, because of precedence rules, I believe. typedef unsigned long * hello_t(int iDevice,unsigned long *ftHandle); will compile, but the * goes with the unsigned long, i.e., hello_t is a function that returns an unsigned long *. _________________________________________________________________ Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail |