diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/driver/phases/CExport.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/driver/phases/CExport.kt new file mode 100644 index 00000000000..deac20af798 --- /dev/null +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/driver/phases/CExport.kt @@ -0,0 +1,19 @@ +/* + * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.backend.konan.driver.phases + +import org.jetbrains.kotlin.backend.konan.cexport.CAdapterExportedElements +import org.jetbrains.kotlin.backend.konan.cexport.CAdapterGenerator +import org.jetbrains.kotlin.backend.konan.cexport.CAdapterTypeTranslator + +internal val BuildCExports = createSimpleNamedCompilerPhase( + "BuildCExports", "Build C exports", + outputIfNotEnabled = { _, _, _, _ -> error("") } +) { context, input -> + val prefix = context.config.fullExportedNamePrefix.replace("-|\\.".toRegex(), "_") + val typeTranslator = CAdapterTypeTranslator(prefix, context.builtIns) + CAdapterGenerator(context, input.moduleDescriptor, typeTranslator).buildExports(context.symbolTable!!) +} \ No newline at end of file