Re: segfault using string from c?

2017-07-16 Thread segmentation_fault
ok fixed i had to call NimMain(); this fixed everything PyMODINIT_FUNC PyInit_fib(void) { NimMain(); return PyModule_Create(&nim_module); }

Re: segfault using string from c?

2017-07-16 Thread segmentation_fault
thx this got the $fpx working now getting a segfault when i do open(), ill investigate further i guess its something related it works perfectly fine when not calling it from c.

Re: segfault using string from c?

2017-07-16 Thread segmentation_fault
yes i tried that but if i do $fpx i get a segfault on the $fpx valgrind segfult line the compiled code is at fp = cstrToNimstr(fpx);

Re: segfault using string from c?

2017-07-16 Thread segmentation_fault
if it helps this is the valgrind output ==9355== Process terminating with default action of signal 11 (SIGSEGV) ==9355== Access not within mapped region at address 0x0 ==9355==at 0x665CA1B: lowGauge_3mwQtFaBTgevFrybZdgUNw (stdlib_system.c:1380) ==9355==by 0x6664

segfault using string from c?

2017-07-16 Thread segmentation_fault
How can you pass a char * to nim, ive been trying for a while but i keep getting segfault. if i use: proc read_csv(fpx: cstring): void {.exportc.} = let fp: string = cast[string](fpx) var s = newFileStream(fp, fmRead) if s == nil: echo "file not f