我正在学习DirectX和Rust,我想在我的项目中使用DX敏捷SDK. 为此,我需要在最终可执行文件中导出两个符号,以便DirectX可以加载系统中可用的最佳DLL,如this guide中所述.
这就是我try 过的:
#[used]
#[no_mangle]
#[export_name = "D3D12SDKVersion"]
pub static D3D12_SDK_VERSION: u32 = 711; // SDK 1.711.3-preview
然后,我使用转储工具判断可执行文件是否包含导出的符号(它没有):
dumpbin .\test.exe /EXPORTS
Microsoft (R) COFF/PE Dumper Version 14.40.33521.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file .\test.exe
File Type: EXECUTABLE IMAGE
Summary
1000 .data
4000 .pdata
10000 .rdata
1000 .reloc
33000 .text
但我希望它输出如下内容:
dumpbin .\test.exe /EXPORTS
Microsoft (R) COFF/PE Dumper Version 14.40.33521.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file .\test.exe
File Type: EXECUTABLE IMAGE
Section contains the following exports for WinLauncher.exe
00000000 characteristics
FFFFFFFF time date stamp
0.00 version
1 ordinal base
2 number of functions
2 number of names
ordinal hint RVA name
1 0 00030220 D3D12SDKVersion
Summary
1000 .data
4000 .pdata
10000 .rdata
1000 .reloc
33000 .text
我真的不知道如何设置编译器和构建脚本来导出这些代码.如有任何帮助,我们不胜感激!