Closed MattiaBettini closed 2 years ago
Same here. My quick workaround until it gets fixed:
#define SOKOL_MALLOC _simgui_malloc
#define SOKOL_FREE _simgui_free
#include "sokol_gp/sokol_gp.h"
#undef SOKOL_MALLOC
#undef SOKOL_FREE
bumping as I'm running into this as well when trying to build this into a dll with sokol
/Users/kyle/Workspace/fips-workspace/fips-sokol_gp/sokol_gp/sokol_gp.h:1106:36: error: implicit declaration of function 'SOKOL_MALLOC' is invalid
in C99 [-Werror,-Wimplicit-function-declaration]
_sgp.vertices = (_sgp_vertex*) SOKOL_MALLOC(_sgp.num_vertices * sizeof(_sgp_vertex));
^
/Users/kyle/Workspace/fips-workspace/fips-sokol_gp/sokol_gp/sokol_gp.h:1106:21: warning: cast to '_sgp_vertex *' (aka 'struct _sgp_vertex *')
from smaller integer type 'int' [-Wint-to-pointer-cast]
_sgp.vertices = (_sgp_vertex*) SOKOL_MALLOC(_sgp.num_vertices * sizeof(_sgp_vertex));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/kyle/Workspace/fips-workspace/fips-sokol_gp/sokol_gp/sokol_gp.h:1107:21: warning: cast to 'sgp_uniform *' (aka 'struct sgp_uniform *')
from smaller integer type 'int' [-Wint-to-pointer-cast]
_sgp.uniforms = (sgp_uniform*) SOKOL_MALLOC(_sgp.num_uniforms * sizeof(sgp_uniform));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/kyle/Workspace/fips-workspace/fips-sokol_gp/sokol_gp/sokol_gp.h:1108:21: warning: cast to '_sgp_command *' (aka 'struct _sgp_command *')
from smaller integer type 'int' [-Wint-to-pointer-cast]
_sgp.commands = (_sgp_command*) SOKOL_MALLOC(_sgp.num_commands * sizeof(_sgp_command));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/kyle/Workspace/fips-workspace/fips-sokol_gp/sokol_gp/sokol_gp.h:1186:9: error: implicit declaration of function 'SOKOL_FREE' is invalid in
C99 [-Werror,-Wimplicit-function-declaration]
SOKOL_FREE(_sgp.vertices);
Actually trying to do all this now, taking on the imgui dep just to resolve the malloc is proving to be a giant PITA (cimgui.h having issues compiling on M1) — @edubart I'm still mostly a C noob but if you have any tips to resolve this directly in sokol_gp instead of routing through imgui that would be great! happy to try and tackle it and submit a pr if it seems like an easy fix.
I've updated the library to use latest sokol allocator system, it should fix this.
Thanks so much @edubart ! Trying now.
I'm working on a visual studio project using sokol_gfx and sokol_gp.
I am using sokol_gfx master branch after allocator-interface merge.
The first error I had was: "'SOKOL_MALLOC': identifier not found" from sokol_gp, after doing an extended search I found this error in conditional compilation at line 2625 of sokol_gfx.h: "SOKOL_MALLOC / CALLOC / FREE macros are no longer supported, please use sg_desc.allocator to override memory allocation functions ".
Is there a fix for this problem? or am I doing something wrong?