1/* 2 * Copyright (c) 2024-2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { KInt, KLong, KBoolean, KFloat, KUInt, KStringPtr, KPointer, KNativePointer, KInt32ArrayPtr, KUint8ArrayPtr, KFloat32ArrayPtr, pointer, KInteropReturnBuffer, KSerializerBuffer, loadNativeModuleLibrary, NativeBuffer } from "@koalaui/interop" 17import { int32, int64, float32 } from "@koalaui/common" 18 19export class TestNativeModule { 20 static { 21 loadNativeModuleLibrary("TestNativeModule") 22 } 23 native static _TestCallIntNoArgs(arg0: int32): int32 24 native static _TestCallIntIntArraySum(arg0: int32, arg1: KInt32ArrayPtr, arg2: int32): int32 25 native static _TestCallVoidIntArrayPrefixSum(arg0: int32, arr: KInt32ArrayPtr, arg2: int32): void 26 native static _TestCallIntRecursiveCallback(arg0: int32, arr: KSerializerBuffer, arg2: int32): int32 27 native static _TestCallIntMemory(arg0: int32, arg1: int32): int32 28 @ani.unsafe.Quick 29 native static _TestWithBuffer(buffer: NativeBuffer): void 30 @ani.unsafe.Direct 31 native static _TestGetManagedCaller(kind: int32): KPointer 32 @ani.unsafe.Direct 33 native static _TestGetManagedCallerSync(kind: int32): KPointer 34 @ani.unsafe.Direct 35 native static _TestGetManagedHolder(): KPointer 36 @ani.unsafe.Direct 37 native static _TestGetManagedReleaser(): KPointer 38 @ani.unsafe.Quick 39 native static _TestReadAndMutateManagedBuffer(arr: KUint8ArrayPtr, len: int32): void 40}