gmp_lib.mp_get_memory_functions Method

GMP Native Interface for .NET

gmp_libmp_get_memory_functions Method
Get the current allocation functions, storing function pointers to the locations given by the arguments.

Namespace:  Math.Gmp.Native
Assembly:  Math.Gmp.Native (in Math.Gmp.Native.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public static void mp_get_memory_functions(
	ref allocate_function alloc_func_ptr,
	ref reallocate_function realloc_func_ptr,
	ref free_function free_func_ptr
)
Public Shared Sub mp_get_memory_functions ( 
	ByRef alloc_func_ptr As allocate_function,
	ByRef realloc_func_ptr As reallocate_function,
	ByRef free_func_ptr As free_function
)
public:
static void mp_get_memory_functions(
	allocate_function^% alloc_func_ptr, 
	reallocate_function^% realloc_func_ptr, 
	free_function^% free_func_ptr
)
static member mp_get_memory_functions : 
        alloc_func_ptr : allocate_function byref * 
        realloc_func_ptr : reallocate_function byref * 
        free_func_ptr : free_function byref -> unit 

Parameters

alloc_func_ptr
Type: Math.Gmp.Nativeallocate_function
The memory allocation function.
realloc_func_ptr
Type: Math.Gmp.Nativereallocate_function
The memory reallocation function.
free_func_ptr
Type: Math.Gmp.Nativefree_function
The memory de-allocation function.
Examples
allocate_function allocate;
reallocate_function reallocate;
free_function free;

// Retrieve the GMP memory allocation functions.
allocate = null;
reallocate = null;
free = null;
gmp_lib.mp_get_memory_functions(ref allocate, ref reallocate, ref free);
Assert.IsTrue(allocate != null && reallocate != null && free != null);

// Allocate and free memory.
void_ptr p = allocate(100);
free(p, 100);
Dim allocate As allocate_function
Dim reallocate As reallocate_function
Dim free As free_function

' Retrieve the GMP memory allocation functions.
allocate = Nothing
reallocate = Nothing
free = Nothing
gmp_lib.mp_get_memory_functions(allocate, reallocate, free)
Assert.IsTrue(allocate IsNot Nothing AndAlso reallocate IsNot Nothing AndAlso free IsNot Nothing)

' Allocate and free memory.
Dim p As void_ptr = allocate(100)
free(p, 100)

No code example is currently available or this language may not be supported.

No code example is currently available or this language may not be supported.

See Also