rustc_llvm: Don't export constants across dlls

For imports of constants across DLLs to work on Windows it *requires* that the
import be marked with `dllimport` (unlike functions where the marker is
optional, but strongly recommended). This currently isn't working for importing
FFI constants across boundaries, however, so the one constant exported from
`rustc_llvm.dll` is now a function to be called instead.
This commit is contained in:
Alex Crichton 2015-05-11 21:07:38 -07:00
parent b538189ba0
commit 847c8520b1
3 changed files with 5 additions and 3 deletions

View File

@ -1771,7 +1771,7 @@ extern {
Dialect: c_uint)
-> ValueRef;
pub static LLVMRustDebugMetadataVersion: u32;
pub fn LLVMRustDebugMetadataVersion() -> u32;
pub fn LLVMRustAddModuleFlag(M: ModuleRef,
name: *const c_char,

View File

@ -193,7 +193,7 @@ pub fn finalize(cx: &CrateContext) {
// Prevent bitcode readers from deleting the debug info.
let ptr = "Debug Info Version\0".as_ptr();
llvm::LLVMRustAddModuleFlag(cx.llmod(), ptr as *const _,
llvm::LLVMRustDebugMetadataVersion);
llvm::LLVMRustDebugMetadataVersion());
};
}

View File

@ -233,7 +233,9 @@ DIT unwrapDI(LLVMMetadataRef ref) {
return DIT(ref ? unwrap<MDNode>(ref) : NULL);
}
extern "C" const uint32_t LLVMRustDebugMetadataVersion = DEBUG_METADATA_VERSION;
extern "C" const uint32_t LLVMRustDebugMetadataVersion() {
return DEBUG_METADATA_VERSION;
}
extern "C" void LLVMRustAddModuleFlag(LLVMModuleRef M,
const char *name,