diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/OutputFiles.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/OutputFiles.kt index dcb275b2920..588472ee4a0 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/OutputFiles.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/OutputFiles.kt @@ -27,7 +27,7 @@ class OutputFiles(outputPath: String?, target: KonanTarget, produce: CompilerOut * Header file for dynamic library. */ val cAdapterHeader by lazy { File("${outputName}_api.h") } - val cAdapterDef by lazy { File("${outputName}_symbols.def") } + val cAdapterDef by lazy { File("${outputName}.def") } /** * Main compiler's output file. diff --git a/runtime/src/main/cpp/ExecFormat.cpp b/runtime/src/main/cpp/ExecFormat.cpp index fb4fe50f957..f5bd74669dd 100644 --- a/runtime/src/main/cpp/ExecFormat.cpp +++ b/runtime/src/main/cpp/ExecFormat.cpp @@ -315,8 +315,11 @@ extern "C" bool AddressToSymbol(const void* address, char* resultBuffer, size_t if (theExeSymbolTable == nullptr) { // Note: do not protecting the lazy initialization by critical sections for simplicity; // this doesn't have any serious consequences. - theExeSymbolTable = konanConstructInstance( - GetModuleHandle(nullptr)); + HMODULE hModule = nullptr; + int rv = GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, + reinterpret_cast(&AddressToSymbol), &hModule); + RuntimeAssert(rv != 0, "GetModuleHandleExW fails"); + theExeSymbolTable = konanConstructInstance(hModule); } return theExeSymbolTable->functionAddressToSymbol(address, resultBuffer, resultBufferSize); }