Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
TestToolChainDemo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
dsq
TestToolChainDemo
Commits
3676984b
Commit
3676984b
authored
Aug 28, 2026
by
lixuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:IR12
parent
67eef1b9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
0 deletions
+48
-0
TestLambda.kt
...oseApp/src/ohosArm64Main/kotlin/com/lx/IR12/TestLambda.kt
+16
-0
TestLambda.kt
composeApp/src/ohosX64Main/kotlin/com/lx/IR12/TestLambda.kt
+16
-0
napi_init.cpp
harmonyApp/entry/src/main/cpp/napi_init.cpp
+7
-0
Index.d.ts
harmonyApp/entry/src/main/cpp/types/libentry/Index.d.ts
+3
-0
Index.ets
harmonyApp/entry/src/main/ets/pages/Index.ets
+6
-0
No files found.
composeApp/src/ohosArm64Main/kotlin/com/lx/IR12/TestLambda.kt
0 → 100644
View file @
3676984b
package
com.lx.IR12
import
kotlinx.cinterop.ExperimentalForeignApi
import
platform.PerformanceAnalysisKit.HiLog.OH_LOG_Print
import
kotlin.experimental.ExperimentalNativeApi
class
TestLambda
{
val
stringPlus
:
(
String
,
String
)
->
String
=
String
::
plus
}
@OptIn
(
ExperimentalNativeApi
::
class
,
ExperimentalForeignApi
::
class
)
@CName
(
"TestLambdaStringPlus"
)
fun
TestLambdaStringPlus
()
{
val
stringPlus
=
TestLambda
().
stringPlus
(
"a========================"
,
"b"
)
OH_LOG_Print
(
0
u
,
4
u
,
4660
u
,
"TestLambda"
,
stringPlus
)
}
composeApp/src/ohosX64Main/kotlin/com/lx/IR12/TestLambda.kt
0 → 100644
View file @
3676984b
package
com.lx.IR12
import
kotlinx.cinterop.ExperimentalForeignApi
import
platform.PerformanceAnalysisKit.HiLog.OH_LOG_Print
import
kotlin.experimental.ExperimentalNativeApi
class
TestLambda
{
val
stringPlus
:
(
String
,
String
)
->
String
=
String
::
plus
}
@OptIn
(
ExperimentalNativeApi
::
class
,
ExperimentalForeignApi
::
class
)
@CName
(
"TestLambdaStringPlus"
)
fun
TestLambdaStringPlus
()
{
val
stringPlus
=
TestLambda
().
stringPlus
(
"a========================"
,
"b"
)
OH_LOG_Print
(
0
u
,
4
u
,
4660
u
,
"TestLambda"
,
stringPlus
)
}
harmonyApp/entry/src/main/cpp/napi_init.cpp
View file @
3676984b
...
...
@@ -13,7 +13,13 @@ static napi_value NapiMainArkUIViewController(napi_env env, napi_callback_info /
return
reinterpret_cast
<
napi_value
>
(
::
MainArkUIViewController
(
env
));
}
static
napi_value
nativeTestLambdaStringPlus
(
napi_env
env
,
napi_callback_info
/*info*/
)
{
TestLambdaStringPlus
();
napi_value
undefined
;
napi_get_undefined
(
env
,
&
undefined
);
return
undefined
;
}
static
napi_value
nativeTestArkTsToKotin
(
napi_env
env
,
napi_callback_info
info
)
{
testArkTsToKotin
();
...
...
@@ -29,6 +35,7 @@ static napi_value Init(napi_env env, napi_value exports) {
napi_property_descriptor
desc
[]
=
{
{
"MainArkUIViewController"
,
nullptr
,
NapiMainArkUIViewController
,
nullptr
,
nullptr
,
nullptr
,
napi_default
,
nullptr
},
{
"testArkTsToKotin"
,
nullptr
,
nativeTestArkTsToKotin
,
nullptr
,
nullptr
,
nullptr
,
napi_default
,
nullptr
},
{
"testLambdaStringPlus"
,
nullptr
,
nativeTestLambdaStringPlus
,
nullptr
,
nullptr
,
nullptr
,
napi_default
,
nullptr
},
};
napi_define_properties
(
env
,
exports
,
sizeof
(
desc
)
/
sizeof
(
desc
[
0
]),
desc
);
return
exports
;
...
...
harmonyApp/entry/src/main/cpp/types/libentry/Index.d.ts
View file @
3676984b
...
...
@@ -4,9 +4,12 @@ export const MainArkUIViewController: () => ArkUIViewController
export
const
testArkTsToKotin
:
()
=>
void
export
const
testLambdaStringPlus
:
()
=>
void
declare
const
nativeApi
:
{
MainArkUIViewController
:
typeof
MainArkUIViewController
testArkTsToKotin
:
typeof
testArkTsToKotin
testLambdaStringPlus
:
typeof
testLambdaStringPlus
}
export
default
nativeApi
harmonyApp/entry/src/main/ets/pages/Index.ets
View file @
3676984b
...
...
@@ -57,6 +57,12 @@ struct Index {
build() {
Column() {
Button('测试 Lambda')
.onClick(() => {
hilog.info(DOMAIN, 'Compose', 'testLambdaStringPlus button clicked');
nativeApi.testLambdaStringPlus();
hilog.info(DOMAIN, 'Compose', 'testLambdaStringPlus native call returned');
})
if (this.controller) {
Compose({
controller: this.controller,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment