ldc/tests/codegen/export.d
Martin 67d5fe5624 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.
2016-11-15 21:15:56 +01:00

19 lines
340 B
D

// RUN: %ldc -output-ll -of=%t.ll %s
// RUN: FileCheck %s < %t.ll
// REQUIRES: Windows
export
{
// CHECK-DAG: define dllexport {{.*}}_D6export11exportedFooFZv
void exportedFoo() {}
// CHECK-DAG: declare dllimport {{.*}}_D6export11importedFooFZv
void importedFoo();
}
void bar()
{
exportedFoo();
importedFoo();
}