-
-
Notifications
You must be signed in to change notification settings - Fork 812
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide cmake WINDOWS_EXPORT_ALL_SYMBOLS utility #1123
Comments
目前暂时不考虑提供 特定平台的 api 接口,xmake 的配置接口,大部分都是 全平台抽象通用的。def文件的设置,原本就只需要一的 flags就能搞定:#153 |
这个不是设置def文件,是自动生成def文件 |
那就只能 提供个 扩展 modules 了,用户有需要 自己在 after_build 里面 import 后使用它去dump生成 def 文件就行了 |
我已经在dev上支持这个特性 Ruleshttps://github.com/xmake-io/xmake/tree/dev/xmake/rules/utils/symbols/export_all
Examplehttps://github.com/xmake-io/xmake/tree/dev/tests/projects/c/shared_library_export_all add_rules("mode.release", "mode.debug")
target("foo")
set_kind("shared")
add_files("src/foo.c")
add_rules("utils.symbols.export_all")
target("test")
set_kind("binary")
add_deps("foo")
add_files("src/main.c") References |
我的工程生成的 export_all.def 会导出一个叫 "=="的符号 ,导致编译不过。 手动把 "=="去掉可以了。 工程比较复杂不方便上传。 |
除了导出所有符号,现在还支持指定导出特定符号列表,全平台支持。。#2121 |
你在什么场景下需要该功能?
https://cmake.org/cmake/help/latest/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.html#prop_tgt:WINDOWS_EXPORT_ALL_SYMBOLS
Enable this boolean property to automatically create a module definition (.def) file with all global symbols found in the input .obj files for a SHARED library (or executable with ENABLE_EXPORTS) on Windows. The module definition file will be passed to the linker causing all symbols to be exported from the .dll. For global data symbols, __declspec(dllimport) must still be used when compiling against the code in the .dll. All other function symbols will be automatically exported and imported by callers. This simplifies porting projects to Windows by reducing the need for explicit dllexport markup, even in C++ classes.
启用此布尔属性,可以自动创建一个模块定义(.def)文件,其中包含在Windows上的共享库(或使用ENABLE_EXPORTS的可执行文件)的输入.obj文件中找到的所有全局符号。模块定义文件将被传递给链接器,使所有符号从.dll中导出。对于全局数据符号,当对.dll中的代码进行编译时,仍然必须使用__declspec(dllimport)。所有其它的函数符号将被调用者自动导出和导入。这就简化了将项目移植到 Windows 的过程,减少了对显式 dllexport 标记的需求,甚至在 C++ 类中也是如此。
描述可能的解决方案
和CMake一致即可
The text was updated successfully, but these errors were encountered: