From 0fe1b687531710071d7c5a85cc59577481a06c9b Mon Sep 17 00:00:00 2001 From: vnugent Date: Mon, 27 Mar 2023 12:22:32 -0400 Subject: Version bump, update method calling convention --- lib/NativeHeapApi/src/NativeHeapApi.h | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'lib/NativeHeapApi/src/NativeHeapApi.h') diff --git a/lib/NativeHeapApi/src/NativeHeapApi.h b/lib/NativeHeapApi/src/NativeHeapApi.h index 5e83108..00ca2b8 100644 --- a/lib/NativeHeapApi/src/NativeHeapApi.h +++ b/lib/NativeHeapApi/src/NativeHeapApi.h @@ -27,6 +27,18 @@ /* * Method calling convention for export */ +#ifndef HEAP_METHOD_CC + #ifdef WIN32 + #define HEAP_METHOD_CC __stdcall + #else + #define HEAP_METHOD_CC + #endif // WIN32 +#endif // !HEAP_METHOD_CC + + +/* +* Decorator for exporting methods for dll usage +*/ #ifndef HEAP_METHOD_EXPORT #ifdef WIN32 #define HEAP_METHOD_EXPORT __declspec(dllexport) @@ -81,13 +93,13 @@ typedef struct UnmanagedHeapFlags /// /// Creation flags passed by the caller to create the heap. This structure will be initialized, and may be modified /// A boolean value that indicates the result of the operation -HEAP_METHOD_EXPORT ERRNO heapCreate(UnmanagedHeapFlags* flags); +HEAP_METHOD_EXPORT ERRNO HEAP_METHOD_CC heapCreate(UnmanagedHeapFlags* flags); /// /// Destroys a previously created heap /// /// The pointer to your custom heap structure from heap creation -HEAP_METHOD_EXPORT ERRNO heapDestroy(LPVOID heap); +HEAP_METHOD_EXPORT ERRNO HEAP_METHOD_CC heapDestroy(LPVOID heap); /// /// Allocates a block from the desired heap and returns a pointer @@ -98,7 +110,7 @@ HEAP_METHOD_EXPORT ERRNO heapDestroy(LPVOID heap); /// The alignment (or size) of each element in bytes /// A flag to zero the block before returning the block /// A pointer to the allocated block -HEAP_METHOD_EXPORT LPVOID heapAlloc(LPVOID heap, size_t elements, size_t alignment, BOOL zero); +HEAP_METHOD_EXPORT LPVOID HEAP_METHOD_CC heapAlloc(LPVOID heap, size_t elements, size_t alignment, BOOL zero); /// /// Reallocates a block on the desired heap and returns a pointer to the new block. If reallocation @@ -111,7 +123,7 @@ HEAP_METHOD_EXPORT LPVOID heapAlloc(LPVOID heap, size_t elements, size_t alignme /// The element size or block alignment /// A flag to zero the block (or the new size) before returning. /// A pointer to the reallocated block, or zero if the operation failed or is not supported -HEAP_METHOD_EXPORT LPVOID heapRealloc(LPVOID heap, LPVOID block, size_t elements, size_t alignment, BOOL zero); +HEAP_METHOD_EXPORT LPVOID HEAP_METHOD_CC heapRealloc(LPVOID heap, LPVOID block, size_t elements, size_t alignment, BOOL zero); /// /// Frees a previously allocated block on the desired heap. @@ -119,6 +131,6 @@ HEAP_METHOD_EXPORT LPVOID heapRealloc(LPVOID heap, LPVOID block, size_t elements /// A pointer to your heap structure /// A pointer to the block to free /// A value that indicates the result of the operation, nonzero if success, 0 if a failure occurred -HEAP_METHOD_EXPORT ERRNO heapFree(LPVOID heap, LPVOID block); +HEAP_METHOD_EXPORT ERRNO HEAP_METHOD_CC heapFree(LPVOID heap, LPVOID block); #endif // !NATIVE_HEAP_API \ No newline at end of file -- cgit