Reputation: 1992
Can anyone please provide me the full meaning of the following 2 lines of codes?
typedef void DLLEXPORT __stdcall (*DLL_Inquiry) (char *cDriverName, int *iDriverType, int *iDriverBUS, int *iNumberOfChannel);
DLL_Inquiry DRV_PH_Inquiry;
I know that DLLEXPORT
is to export a function from the DLL, __stdcall
is the x86 argument passing convention.
But still I am not able to get the whole meaning of these 2 lines. May be I am confused with use of function or function pointer in typedef
.
Upvotes: 0
Views: 2013
Reputation: 613382
typedef void DLLEXPORT __stdcall (*DLL_Inquiry) (
char *cDriverName, int *iDriverType, int *iDriverBUS, int *iNumberOfChannel);
This defines a typedef for DLL_Inquiry
to be a function pointer.
void
return type. __stdcall
.DLLEXPORT
is not standard. That will be found in your code. Most likely there will be a header file that defines DLLEXPORT
as a macro. For instance, when compiling the DLL, on the Windows platform, it might evaluate to __declspec(dllexport)
. In any case, only you can know for sure what the definition of DLLEXPORT
is.Upvotes: 1
Reputation: 33283
DLL_Incuiry
is a typedef for a pointer to function that takes arguments (char*, int*, int*, int*)
and returns no value (return type void
). The function also uses the calling convention defined by DLLEXPORT and __stdcall.
DRV_PH_Inquiry
is a variable of that type, so if you have function foo
:
void DLLEXPORT __stdcall foo (char *cDriverName, int *iDriverType, int *iDriverBUS, int *iNumberOfChannel);
you can then do the assignment:
DRV_PH_Inquiry = foo; // DRV_PH_Inquiry now points to the function foo
Upvotes: 1