[K/N] Move cinterop tests from standalone to codegen/box
^KT-61259
This commit is contained in:
committed by
Space Team
parent
0b0ba3160f
commit
c09e8909d4
@@ -0,0 +1,41 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FREE_CINTEROP_ARGS: -header auxiliaryCppSources.h
|
||||
|
||||
// MODULE: cinterop
|
||||
// FILE: auxiliaryCppSources.def
|
||||
# The def file is intentionally empty
|
||||
# `auxiliaryCppSources.h` is meant to be included via `-header` free arg of cinterop tool
|
||||
|
||||
// FILE: auxiliaryCppSources.h
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
const char* name();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
// FILE: auxiliaryCppSources.cpp
|
||||
#include <string>
|
||||
#include "auxiliaryCppSources.h"
|
||||
|
||||
static std::string _name = "OK";
|
||||
|
||||
const char* name() {
|
||||
return _name.c_str();
|
||||
}
|
||||
|
||||
// MODULE: main(cinterop)
|
||||
// FILE: main.kt
|
||||
|
||||
@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
|
||||
|
||||
import auxiliaryCppSources.*
|
||||
import kotlin.test.*
|
||||
import kotlinx.cinterop.*
|
||||
|
||||
fun box(): String {
|
||||
return name()!!.toKString()
|
||||
}
|
||||
Reference in New Issue
Block a user