windows 如何使用序号调用导出的函数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3598108/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I call a exported function using ordinal number
提问by Benjamin
If a dll exports some functions and the functions have only ordinal numbers, how can I call the functions?
如果一个dll导出了一些函数,而这些函数只有序数,我该如何调用这些函数?
Give me a short example please.
请给我一个简短的例子。
回答by Dean Harding
The documentation for GetProcAddressexplains that you pass the integer ordinal in the low-order word of the lpProcName
parameter. The MAKEINTRESOURCEmacro can actually be used to make this a little easier:
GetProcAddress的文档说明您在lpProcName
参数的低位字中传递整数序数。该MAKEINTRESOURCE宏实际上可以用来轻松一点使这个:
int ordinal = 123;
HANDLE dll = LoadLibrary("MyDLL.dll");
FARPROC fn = GetProcAddress(dll, MAKEINTRESOURCE(ordinal));