mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-04-30 15:10:59 +03:00
Map export
visibility to LLVM DLL storage classes
Compatible with DMD, but restricted to Windows and functions only. `export` functions with bodies get the dllexport attribute and will be exported if the containing object is pulled in when linking. Body-less `export` functions get the dllimport attribute and will be accessed via an import table indirection, set up at runtime by the OS. This is a temporary solution, the proper fix is a pending DMD PR, after which LDC will need to be adapted.
This commit is contained in:
parent
8a2a6c1e7f
commit
67d5fe5624
6 changed files with 60 additions and 1 deletions
|
@ -851,6 +851,14 @@ void DtoResolveVariable(VarDeclaration *vd) {
|
|||
// as well).
|
||||
gvar->setAlignment(DtoAlignment(vd));
|
||||
|
||||
/* TODO: set DLL storage class when `export` is fixed (an attribute)
|
||||
if (global.params.isWindows && vd->isExport()) {
|
||||
auto c = vd->isImportedSymbol() ? LLGlobalValue::DLLImportStorageClass
|
||||
: LLGlobalValue::DLLExportStorageClass;
|
||||
gvar->setDLLStorageClass(c);
|
||||
}
|
||||
*/
|
||||
|
||||
applyVarDeclUDAs(vd, gvar);
|
||||
|
||||
IF_LOG Logger::cout() << *gvar << '\n';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue