I have 0.10.2 on OSx10.9.5 and installed the opengl package using nimble I can compile a simple glut_example.nim from github https://github.com/nim-lang/opengl but when it runs in crashes after entering glut_init() with a SIGSEGV: Illegal storage access. at line lib/system/gc.nim(1055) GC_enable ***
Is this a known issue?
I am getting this on my mac:
/glut_example
glut_example(2578,0x7fff722aa300) malloc: *** mach_vm_map(size=18446744070157651968) failed (error code=3)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
2015-02-25 01:19:06.327 glut_example[2578:1040079] GLUT Fatal Error: out of memory.
I could fix it by adding dummy parameter to the initGlut() call like this:
var x: cint = 0
glutInit(addr x, nil)
In glut.nim is the following code:
{.push dynlib: dllname, importc.}
proc glutInit*(argcp: ptr cint, argv: pointer)
proc glutInit*() =
## version that passes `argc` and `argc` implicitely.
var
cmdLine {.importc: "cmdLine".}: array[0..255, cstring]
cmdCount {.importc: "cmdCount".}: cint
glutInit(addr(cmdCount), addr(cmdLine))
It looks to me as if that is not used but the original is called without any parameters?
Great thanks OderWat, that worked.
I have just discovered Nim and am very impressed.