Skip to content

create_memory_block_externCreateMemoryBlockExternCreateMemoryBlockExterncreate_memory_block_externT_create_memory_block_extern🔗

Short description🔗

create_memory_block_externCreateMemoryBlockExternCreateMemoryBlockExterncreate_memory_block_externT_create_memory_block_extern — Create a memory block from an external pointer.

Warning🔗

It is not recommended to use the operator create_memory_block_externCreateMemoryBlockExtern in HDevelop.

Signature🔗

create_memory_block_extern( pointer Pointer, integer Size, pointer FreeFunction, out memory_block MemoryBlockHandle )void CreateMemoryBlockExtern( const HTuple& Pointer, const HTuple& Size, const HTuple& FreeFunction, HTuple* MemoryBlockHandle )static void HOperatorSet.CreateMemoryBlockExtern( HTuple pointer, HTuple size, HTuple freeFunction, out HTuple memoryBlockHandle )def create_memory_block_extern( pointer: int, size: int, free_function: int ) -> HHandle

Herror T_create_memory_block_extern( const Htuple Pointer, const Htuple Size, const Htuple FreeFunction, Htuple* MemoryBlockHandle )

void HMemoryBlock::HMemoryBlock( void* Pointer, Hlong Size, void* FreeFunction )

public HMemoryBlock( IntPtr pointer, int size, IntPtr freeFunction )

void HMemoryBlock::CreateMemoryBlockExtern( void* Pointer, Hlong Size, void* FreeFunction )

void HMemoryBlock.CreateMemoryBlockExtern( IntPtr pointer, int size, IntPtr freeFunction )

Description🔗

create_memory_block_externCreateMemoryBlockExtern creates a memory block and returns its handle MemoryBlockHandlememoryBlockHandlememory_block_handle. Pointerpointerpointer is a data pointer to the beginning of the memory block. Sizesizesize controls the size in bytes of the memory block. FreeFunctionfreeFunctionfree_function is an optional callback function that frees the memory pointed to by Pointerpointerpointer. This function must have the following signature

      void FreeFunction(void* ptr);

and will be called using __cdecl calling convention when deleting MemoryBlockHandlememoryBlockHandlememory_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 MemoryBlockHandlememoryBlockHandlememory_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_copyCreateMemoryBlockExternCopy can be used.

Execution information🔗

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🔗

Pointerpointerpointer (input_control) pointer → (integer)HTuple (Hlong)HTuple (IntPtr)intHtuple (Hlong)

Data pointer of the memory block.

Sizesizesize (input_control) integer → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Size of the memory block.

FreeFunctionfreeFunctionfree_function (input_control) pointer → (integer)HTuple (Hlong)HTuple (IntPtr)intHtuple (Hlong)

Function to free the memory block.

Default: 00

MemoryBlockHandlememoryBlockHandlememory_block_handle (output_control) memory_block → (handle)HTuple (HHandle)HMemoryBlock, HTuple (IntPtr)HHandleHtuple (handle)

Handle of the memory block.

Result🔗

If the parameters are valid, the operator create_memory_block_externCreateMemoryBlockExtern returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.

Combinations with other operators🔗

Combinations

Possible successors

get_memory_block_ptrGetMemoryBlockPtr, compare_memory_blockCompareMemoryBlock, memory_block_to_imageMemoryBlockToImage, write_memory_blockWriteMemoryBlock

Alternatives

create_memory_block_extern_copyCreateMemoryBlockExternCopy

Module🔗

Foundation