Re: Like C extern pragma?

2020-03-08 Thread Araq
Use `when not declared` instead of `when not defined` and stop using UPPERCASE 
for variables, Nim has no preprocessor.


Re: Like C extern pragma?

2020-03-08 Thread Lachu
I use this hack:


when not defined IS_SUPPORT_IMPORTED:
  var IS_SUPPORT_IMPORTED {.compileTime.} : bool = true


Run

But nim (I use nimble package/project manager) complain about 
IS_SUPPORT_IMPORTED is defined twice.

> /home/postep2/src/posteppkg/utility/includes/support.nim(20, 7) Error: 
> redefinition of 'IS_SUPPORT_IMPORTED'; previous declaration here: 
> /home/postep2/src/posteppkg/utility/includes/support.nim(20, 7)|   
> ---|---


Re: Like C extern pragma?

2020-03-07 Thread Lachu
Ok. I found the problem. It was I use c2nim and it puts asterisk after 
procedure name. That was obvious. Procedure must been defined in the same file, 
because it was marked as to be exported. Because It was C header file (and 
after use of c2nim it was nim file contains only signature/prototypes/etc.), I 
revert state of file and removes asterisk.


Like C extern pragma?

2020-03-07 Thread Lachu
I found information about extern pragma, but It don't describe what it does. I 
need C-like extern pragma or way to use only function prototype (and include 
file with these prototypes). That's because I have problem with circual import 
of modules. Nim compiler complain about missing function implementation, when I 
tries to do that (only declaration of function in file, implementation in 
another).