-
Notifications
You must be signed in to change notification settings - Fork 16
physac redefinition of 'struct Vector2'
#49
Comments
When i look into the module c file @mmodule.nim.c /* Generated by Nim Compiler v1.6.0 */
/* Compiled for: Windows, amd64, gcc */
/* Command for C compiler:
gcc.exe -c -w -fmax-errors=3 -mno-ms-bitfields -DWIN32_LEAN_AND_MEAN -Wall -D_DEFAULT_SOURCE -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing -std=c99 -s -O1 -Werror=implicit-function-declaration -IC:\Users\david\projects\nimraylib_now\src\csources\raylib_mangled -IC:\Users\david\projects\nimraylib_now\src\csources\raylib_mangled\external\glfw\include -IC:\Users\david\projects\nimraylib_now\src\csources\raylib_mangled\external\glfw\deps\mingw -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -DPHYSAC_IMPLEMENTATION -DPHYSAC_NO_THREADS -DRAYGUI_IMPLEMENTATION -IC:\Users\david\.choosenim\toolchains\nim-1.6.0\lib -Ic:\Users\david\projects\nimPlayground\raylibBug -o C:\Users\david\nimcache\main_d\@mmodule.nim.c.o C:\Users\david\nimcache\main_d\@mmodule.nim.c */
#define NIM_INTBITS 64
#include "nimbase.h"
#include "C:\Users\david\projects\nimraylib_now\src\nimraylib_now\mangled\physac.h"
#include "C:\Users\david\projects\nimraylib_now\src\nimraylib_now\mangled\raylib.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
#define nimfr_(x, y)
#define nimln_(x, y)
typedef NI32 tyEnum_PhysicsShapeType__4XnIM9c0KtgiqP83K0bfZ2w;
typedef Vector2 tyArray__DNYpGxjnxL84RUmckj7N0w[24];
N_LIB_PRIVATE PhysicsBodyData* body_module_2; |
Now when I think of it, maybe there's a solution to do several #if !defined(RL_VECTOR2_TYPE)
// Vector2 type
typedef struct Vector2 {
float x;
float y;
} Vector2;
#endif and passing |
Let's see if someone on the forum can help us https://forum.nim-lang.org/t/8704 |
This is still an issue, please look into it. Using include instead of import is the only way to get around it. If |
@greenfork I doubt this helps, because I don't really understand what's going on, but I tried wrapping all the declarations of
where Just to be clear: I am using raylib as a shared library because I'm on nixOS and the static one fetched via nimble doesn't work here. |
What goes on -- is the incorrect import order of C files #12 (comment) If you already use a dynamic system library, I think the best solution would be to use a third-party physics library. Unfortunately I will need a major rewrite to workaround the issue of incorrect order of imports, it is unlikely to be fixed on the Nim side because when I raised this question, there was little help and no plans to fix it. I plan to do this re-write some time soon but so far it's better to use a third-party library. You can use Nim's "converters" to convert Raylib types to the chosen library types automatically to make it seamless. Or you can make simple wrapping functions for better experience. |
Another flavour of: #12
module.nim
main.nim
The text was updated successfully, but these errors were encountered: