create_memory_block_externT_create_memory_block_externCreateMemoryBlockExternCreateMemoryBlockExterncreate_memory_block_extern (Operator)
Name
create_memory_block_externT_create_memory_block_externCreateMemoryBlockExternCreateMemoryBlockExterncreate_memory_block_extern
— Create a memory block from an external pointer.
Warning
It is not recommended to use the operator create_memory_block_externcreate_memory_block_externCreateMemoryBlockExternCreateMemoryBlockExternCreateMemoryBlockExterncreate_memory_block_extern
in HDevelop.
Signature
Description
create_memory_block_externcreate_memory_block_externCreateMemoryBlockExternCreateMemoryBlockExternCreateMemoryBlockExterncreate_memory_block_extern
creates a memory block and returns its
handle MemoryBlockHandleMemoryBlockHandleMemoryBlockHandleMemoryBlockHandlememoryBlockHandlememory_block_handle
. PointerPointerPointerPointerpointerpointer
is a data pointer to the
beginning of the memory block. SizeSizeSizeSizesizesize
controls the size in bytes of the
memory block. FreeFunctionFreeFunctionFreeFunctionFreeFunctionfreeFunctionfree_function
is an optional callback function that
frees the memory pointed to by PointerPointerPointerPointerpointerpointer
. This function must have the
following signature
void FreeFunction(void* ptr);
and will be called using __cdecl
calling convention when deleting
MemoryBlockHandleMemoryBlockHandleMemoryBlockHandleMemoryBlockHandlememoryBlockHandlememory_block_handle
. Hence, HALCON gains ownership over the memory in
this case and releases the memory via the callback function. If the memory
shall not be released when deleting MemoryBlockHandleMemoryBlockHandleMemoryBlockHandleMemoryBlockHandlememoryBlockHandlememory_block_handle
, i.e., HALCON
shall not own the memory, the NULL-Pointer can be passed.
Attention
This operator does not copy any data. If a copy is required
create_memory_block_extern_copycreate_memory_block_extern_copyCreateMemoryBlockExternCopyCreateMemoryBlockExternCopyCreateMemoryBlockExternCopycreate_memory_block_extern_copy
can be used.
Execution Information
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Processed without parallelization.
This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.
Parameters
PointerPointerPointerPointerpointerpointer
(input_control) pointer →
HTupleintHTupleHtuple (integer) (IntPtr) (Hlong) (Hlong)
Data pointer of the memory block.
SizeSizeSizeSizesizesize
(input_control) integer →
HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Size of the memory block.
FreeFunctionFreeFunctionFreeFunctionFreeFunctionfreeFunctionfree_function
(input_control) pointer →
HTupleintHTupleHtuple (integer) (IntPtr) (Hlong) (Hlong)
Function to free the memory block.
Default:
0
MemoryBlockHandleMemoryBlockHandleMemoryBlockHandleMemoryBlockHandlememoryBlockHandlememory_block_handle
(output_control) memory_block →
HMemoryBlock, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
Handle of the memory block.
Result
If the parameters are valid, the operator create_memory_block_externcreate_memory_block_externCreateMemoryBlockExternCreateMemoryBlockExternCreateMemoryBlockExterncreate_memory_block_extern
returns the value 2 (
H_MSG_TRUE)
. If necessary, an exception is raised.
Possible Successors
get_memory_block_ptrget_memory_block_ptrGetMemoryBlockPtrGetMemoryBlockPtrGetMemoryBlockPtrget_memory_block_ptr
Alternatives
create_memory_block_extern_copycreate_memory_block_extern_copyCreateMemoryBlockExternCopyCreateMemoryBlockExternCopyCreateMemoryBlockExternCopycreate_memory_block_extern_copy
Module
Foundation