DLL导出静态函数 [英] DLL export of a static function

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

问题描述

我有以下静态函数:

static inline HandVal
              StdDeck_StdRules_EVAL_N( StdDeck_CardMask cards, int n_cards )

我可以在DLL中导出此功能吗?

Can I export this function in a DLL? If so, how?

谢谢

迈克

背景信息:

之所以这样做,是因为原始源代码带有一个VS项目,该项目旨在编译为静态(.lib)库。为了使用ctypes / Python,我将项目转换为DLL。

I'm doing this because the original source code came with a VS project designed to compile as a static (.lib) library. In order to use ctypes/Python, I'm converting the project to a DLL.

我以DLL的形式启动了VS项目,并导入了原始源代码。该项目内置到DLL中,但是没有导出任何功能(包括上面列出的功能)(已通过源代码中缺少dllexport以及DLL Export Viewer之类的工具确认)。我尝试遵循此处的一般建议(在标头)无济于事...功能似乎仍然没有导出。

I started a VS project as a DLL and imported the original source code. The project builds into a DLL, but none of the functions (including functions such as the one listed above) are exported (as confirmed by both the absence of dllexport in the source code and tools such as DLL Export Viewer). I tried to follow the general advice here (create an exportable wrapper function within the header) to no avail...functions still don't appear to be exported.

推荐答案

您可能无法从DLL。静态函数等效于该文件的私有函数。

You may not export that function from a DLL. static functions are equivalent to private to that file.

您可以在文件中创建一个调用该方法并将其导出的方法。

You can create a method in the file that calls it and export that.

这篇关于DLL导出静态函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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