如何使用序数来调用导出的函数 [英] How can I call a exported function using ordinal number

查看:249
本文介绍了如何使用序数来调用导出的函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果一个dll导出一些函数,函数只有序数,那我该怎么调用函数?

If a dll exports some functions and the functions have only ordinal numbers, how can I call the functions?

请给我一个简短的例子。

Give me a short example please.

推荐答案

GetProcAddress 解释了您在 lpProcName 参数的低位字中传递整数序数。 MAKEINTRESOURCE 宏实际上可用于制作这更容易一些:

The documentation for GetProcAddress explains that you pass the integer ordinal in the low-order word of the lpProcName parameter. The MAKEINTRESOURCE macro can actually be used to make this a little easier:

int ordinal = 123;
HANDLE dll = LoadLibrary("MyDLL.dll");
FARPROC fn = GetProcAddress(dll, MAKEINTRESOURCE(ordinal));

这篇关于如何使用序数来调用导出的函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆