pub unsafe extern "C" fn OH_ArkUI_QueryModuleInterfaceByName(
type_: ArkUI_NativeAPIVariantKind,
structName: *const c_char,
) -> *mut c_voidAvailable on crate feature
api-12 only.Expand description
Obtains the native API set of a specified type.
§Arguments
-
type- Indicates the type of the native API set provided by ArkUI, for example, ARKUI_NATIVE_NODE and ARKUI_NATIVE_GESTURE. -
structName- Indicates the name of a native struct defined in the corresponding header file, for example, ArkUI_NativeNodeAPI_1 in <arkui/native_node.h>.
§Returns
- Returns the pointer to the abstract native API, which can be used after being converted into a specific type.
#include<arkui/native_interface.h>
#include<arkui/native_node.h>
#include<arkui/native_gesture.h>
auto* anyNativeAPI = OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1");
if (anyNativeAPI) {
auto nativeNodeApi = reinterpret_cast<ArkUI_NativeNodeAPI_1*>(anyNativeAPI);
}
auto anyGestureAPI = OH_ArkUI_QueryModuleInterface(ARKUI_NATIVE_GESTURE, "ArkUI_NativeGestureAPI_1");
if (anyNativeAPI) {
auto basicGestureApi = reinterpret_cast<ArkUI_NativeGestureAPI_1*>(anyGestureAPI);
}Available since API-level: 12