ConfettiFX / The-Forge

The Forge Cross-Platform Rendering Framework PC Windows, Steamdeck (native), Ray Tracing, macOS / iOS, Android, XBOX, PS4, PS5, Switch, Quest 2
Apache License 2.0
4.75k stars 497 forks source link

missing file include creates incomplete DLL export for IMemory.h/MemoryTracking.c #277

Open vlmillet opened 1 year ago

vlmillet commented 1 year ago

MemoryTracking.c is not including IMemory.h, and then do not have the declaration of the tf_*_internal* functions. They are then seen as first declaration and definition and miss the FORGE_API macro which could export them. I tried to include IMemory.h then, but it triggers macro/compilation errors with the #define of tf_malloc. Anyway i guess the solution would be to create a shared include file which only have these declarations:

#ifdef __cplusplus
extern "C"
{
#endif
    FORGE_API bool initMemAlloc(const char* appName);
    FORGE_API void exitMemAlloc(void);

    FORGE_API void* tf_malloc_internal(size_t size, const char* f, int l, const char* sf);
    FORGE_API void* tf_memalign_internal(size_t align, size_t size, const char* f, int l, const char* sf);
    FORGE_API void* tf_calloc_internal(size_t count, size_t size, const char* f, int l, const char* sf);
    FORGE_API void* tf_calloc_memalign_internal(size_t count, size_t align, size_t size, const char* f, int l, const char* sf);
    FORGE_API void* tf_realloc_internal(void* ptr, size_t size, const char* f, int l, const char* sf);
    FORGE_API void  tf_free_internal(void* ptr, const char* f, int l, const char* sf);

#ifdef __cplusplus
}    // extern "C"
#endif

and which would be included in MemoryTracking.c and IMemory.h