nimraylib_now is a Nim wrapper around raylib C library. Raylib has type Rectangle in its header file, windows.h also has type Rectangle. C library is connected to Nim using header pragma. Apparently windows.h is always required when compiling on windows. How do I avoid name collision when compiling on windows?
Official workaround is to insert some code to ignore all types in windows.h. The problem is the order of imports, windows.h must be imported after the workaround which is not the case:
/* Generated by Nim Compiler v1.4.2 */
/* (c) 2020 Andreas Rumpf */
/* The generated code is subject to the original license. */
/* Compiled for: Windows, amd64, gcc */
/* Command for C compiler:
gcc.exe -c -w -fmax-errors=3 -mno-ms-bitfields -DWIN32_LEAN_AND_MEAN -IC:\Users\username\.choosenim\toolchains\nim-1.4.2\lib -IC:\Users\username\nim -o C:\Users\username\nimcache\testing_d\stdlib_system.nim.c.o C:\Users\username\nimcache\testing_d\stdlib_system.nim.c */
#define NIM_INTBITS 64
/* section: NIM_merge_HEADERS */
#include "nimbase.h"
#include <string.h>
#include <setjmp.h>
#include <windows.h> // Here's the problem, windows.h is always included here!
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
// So adding the fix here won't matter because windows.h was already included
#include "C:\Users\username\nimraylib_now\src\nimraylib_now\raylib.h"
Using dynlib for import instead of header is hard because raylib is distributed in 2 forms: dll library and single-source-header C files. Dlls can be loaded okay, C files will have to be cross-compiled into their own dll libraries which I don't know how to do for all OS.
Original thread on github: https://github.com/greenfork/nimraylib_now/issues/5