Function: bytes_to_ptr

C Prototype

None

Python Function

ptr = acl.util.bytes_to_ptr(data)

Function Usage

Converts a bytes object into void* data. The converted data can be transferred to the C function for direct use.

Input Description

data: data of the bytes type.

Return Value

ptr: int, data that can be accessed by the C language.

Restrictions

The input lifetime of this function must be greater than the output lifetime. Otherwise, undefined behaviors may occur.

Precautions

You are advised to use acl.util.bytes_to_ptr to replace acl.util.ptr_to_bytes.

Modification example:

bytes_in = np_arr_in.tobytes()
bytes_ptr = acl.util.bytes_to_ptr(bytes_in)