MeshLib C Docs
Loading...
Searching...
No Matches
common.h
Go to the documentation of this file.
1#pragma once
2
3#include <MRCMisc/exports.h>
4
5#include <stddef.h>
6
7#ifdef __APPLE__
8#include <stddef.h>
9typedef ptrdiff_t MR_int64_t;
10typedef size_t MR_uint64_t;
11#else
12#include <stdint.h>
13typedef int64_t MR_int64_t;
14typedef uint64_t MR_uint64_t;
15#endif
16
17
18typedef enum MR_PassBy
19{
20 MR_PassBy_DefaultConstruct, // Default-construct this parameter, the associated pointer must be null.
21 MR_PassBy_Copy, // Copy the object into the function. For most types this doesn't modify the input object, so feel free to cast away constness from it if needed.
22 MR_PassBy_Move, // Move the object into the function. The input object remains alive and still needs to be manually destroyed after.
23 MR_PassBy_DefaultArgument, // If this function has a default argument value for this parameter, uses that; illegal otherwise. The associated pointer must be null.
24 MR_PassBy_NoObject, // This is used to pass no object to the function (functions supporting this will document this fact). This is used e.g. for C++ `std::optional<T>` parameters.
26
28MRC_API void *MR_Alloc(size_t num_bytes);
29
31MRC_API void MR_Free(void *ptr);
32
37MRC_API void *MR_AllocArray(size_t num_bytes);
38
40MRC_API void MR_FreeArray(void *ptr);
41
MRC_API void * MR_AllocArray(size_t num_bytes)
MRC_API void MR_FreeArray(void *ptr)
Deallocates memory that was previously allocated with MR_AllocArray(). Does nothing if the pointer is...
int64_t MR_int64_t
Definition common.h:13
MR_PassBy
Definition common.h:19
@ MR_PassBy_NoObject
Definition common.h:24
@ MR_PassBy_DefaultConstruct
Definition common.h:20
@ MR_PassBy_DefaultArgument
Definition common.h:23
@ MR_PassBy_Move
Definition common.h:22
@ MR_PassBy_Copy
Definition common.h:21
MRC_API void * MR_Alloc(size_t num_bytes)
Allocates n bytes of memory, which can then be freed using MR_Free().
MRC_API void MR_Free(void *ptr)
Deallocates memory that was previously allocated with MR_Alloc(). Does nothing if the pointer is null...
uint64_t MR_uint64_t
Definition common.h:14
#define MRC_API
Definition exports.h:11