From cf45636b6216d1b2beaec83bb129a1927f24f608 Mon Sep 17 00:00:00 2001 From: vnugent Date: Tue, 28 Mar 2023 00:30:25 -0400 Subject: Readme and spelling --- lib/NativeHeapApi/README.md | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'lib/NativeHeapApi/README.md') diff --git a/lib/NativeHeapApi/README.md b/lib/NativeHeapApi/README.md index 5341e63..36d3a6e 100644 --- a/lib/NativeHeapApi/README.md +++ b/lib/NativeHeapApi/README.md @@ -6,21 +6,27 @@ Contains necessary API header files for user defined heap dlls. Contains the req You may copy the [NativeHeapApi.h](src/NativeHeapApi.h) header file into your project and begin implementing the heap methods defined in the header file. -You must define a constant called **HEAP_METHOD_EXPORT** that defines the method calling convention for proper dll loading for your given platform. On windows, this defaults to `__declspec(dllexport)`. +You must define a constant called **HEAP_METHOD_EXPORT** that defines the method decordation for proper dll loading for your given platform. On windows, this defaults to `__declspec(dllexport)`. -When the `heapCreate` method is called, a mutable structure pointer is passed as an argument and expected to be updated by your create method. The VNLib.Utils library implements two types of heaps, a global/shared heap and "private" or "first class" heaps exposed by the Memory namespace. Consumers are allowed to create a private heap to use at will. +You may optionally define a constant **HEAP_METHOD_CC**, which defines the method calling convention. For a windows target, this defaults to __stdcall, as P/Invoke uses the stdcall calling convention. On other platforms this expands to nothimg and P/Invoke uses the CDECL, the default on most platforms. -### UnmanagedHeapFlags structure +When the `heapCreate` method is called, a mutable structure pointer is passed as an argument and expected to be updated by your create method. The VNLib.Utils library implements two types of heaps, a global/shared heap and "private" or "first class" heaps exposed by the Memory namespace. Consumers are allowed to create a private heap to use at will. -`UnmanagedHeapFlags.HeapPointer` - Set your heap pointer that will be passed to all heap methods +### Heap architecture -`UnmanagedHeapFlags.CreationFlags` - Managed creation flags, that may be read and written. The managed heap implementation will observe the result after the `heapCreate` method returns. +To understand the VNLib.Utils heap architecture, please see the Utils [readme](../Utils/README.md). -`UnmanagedHeapFlags.Flags` - Generic flags passed by the caller directly to the heapCreate method, not observed or modified by the managed library in any way. +### UnmanagedHeapDescriptor structure + +`UnmanagedHeapDescriptor.HeapPointer` - Set your heap pointer that will be passed to all heap methods + +`UnmanagedHeapDescriptor.CreationFlags` - Managed creation flags, that may be read and written. The managed heap implementation will observe the result after the `heapCreate` method returns. + +`UnmanagedHeapDescriptor.Flags` - Generic flags passed by the caller directly to the heapCreate method, not observed or modified by the managed library in any way. ### Example Create ``` c -HEAP_METHOD_EXPORT ERRNO heapCreate(UnmanagedHeapFlags* flags) +HEAP_METHOD_EXPORT ERRNO HEAP_METHOD_CC heapCreate(UnmanagedHeapDescriptor* flags) { //Check flags if (flags->CreationFlags & HEAP_CREATION_IS_SHARED) -- cgit