release only runtime crash

2018-09-17 Thread sflennik
My nim program crashes in release but not in debug mode. Some system code is overwriting my json structures causing the crash. The problem is hard to narrow down, it moves around as I add debugging code. I haven't been able to simplify the error case to something that is easy to share. The

Re: Workflow: how do I make a cpp lib in nim?

2018-09-17 Thread ggibson
@sflennik Good suggestion. I did try that but it didn't work.

Re: Interesting idea implemented in Zig

2018-09-17 Thread sflennik
I've used perfect hashing with rust. [https://github.com/sfackler/rust-phf](https://github.com/sfackler/rust-phf) I think it is a great idea and it might be implemented in nim with a macro. If you know the entries at compile time, why not make the map as fast and small as possible. In the

Re: Workflow: how do I make a cpp lib in nim?

2018-09-17 Thread sflennik
There's not an exportcpp pragma in nim that I know about. But have you tried wrapping the nim c code with, extern "C"? Cpp code can compile wrapped c code.

Re: Workflow: how do I make a cpp lib in nim?

2018-09-17 Thread ggibson
Still can't get this working. I even tried having nim export C code, and in the c++ code using `extern "C" int fib(int)` to no avail.

Re: Cannot call function with argument of Nim from Python3

2018-09-17 Thread Hlaaftana
Without talking about nimpy, are you sure you compiled your module correctly? If you just did `nim c nim.nim` it would compile to an executable but since you want a DLL `nim c --app:lib nim.nim` or `nim c --app:staticlib nim.nim` would be what you want.

Re: Cannot call function with argument of Nim from Python3

2018-09-17 Thread toshikiohnogi
Thank you for all your kindness. But I got error message `Error: undeclared identifier: 'nnkTupleConstr'` using nimpy on `nim 0.18.0`. [https://github.com/yglukhov/nimpy/issues/41](https://github.com/yglukhov/nimpy/issues/41)

Re: Workflow: how do I make a cpp lib in nim?

2018-09-17 Thread ggibson
Progress! Thanks @jyapayne, the exportc pragma made the header look correct now. However, I still get the same error. If I try to make a C library instead, and compile a C-only program, then everything works as advertised. I didn't find an exportcpp pragma so I'm still stuck trying to do this

Re: How to call a proc of Base class from a derived class ?

2018-09-17 Thread jlp765
Check out [Getting Started](https://nim-by-example.github.io/oop/)

How to call a proc of Base class from a derived class ?

2018-09-17 Thread kcvinu
Hi, I would like to know how to call a proc in Base class in a derived class ? For the sake of clarity, i have included some VB.NET code. this is my intention. See this. Public Class Animal() '// A Base class Public Weight_of_Animal As Integer

Re: Workflow: how do I make a cpp lib in nim?

2018-09-17 Thread jyapayne
I don't have time right now to give a complete answer, but this link may help you. It's for c linking, but you can easily extend it to cpp.

Workflow: how do I make a cpp lib in nim?

2018-09-17 Thread ggibson
Hi, I've been looking for a couple days and can't find out exactly how this is done. Goal: have cpp/h files generated that I can compile in with my c++ project to include helper functions originally written in nim. I'll try updating to development later to see if that fixes it. What I'm doing:

Re: Cannot call function with argument of Nim from Python3

2018-09-17 Thread juancarlospaco
`# Compile: nim c --app:lib --out:pymodule.so thisfile.nim import nimpy proc myfunction*(name: string): string {.exportpy.} = "Hello " & name ` Run

Re: Cannot call function with argument of Nim from Python3

2018-09-17 Thread mratsim
You should probably look into [nimpy](https://github.com/yglukhov/nimpy)

Cannot call function with argument of Nim from Python3

2018-09-17 Thread toshikiohnogi
I wrote simple code of Nim `nim.nim` below. proc nimSample*(n: cint) {. exportc .} = echo n Run also by Python3 import ctypes nim = ctypes.CDLL('nim') arg = ctypes.c_int(1) nim.nimSample(arg) Run But there are not

Re: CreateFont is not working properly

2018-09-17 Thread kcvinu
Problem solved. It was my mistake. A typo, Its not LOGICPIXELSY, its LOGPIXELSY.

Re: Embedding ssl libraries ?

2018-09-17 Thread enthus1ast
Aiesha_Nazarothi openssl was not building for me with gcc, seems like a bug but idk really.

Re: [Help]update nim ubuntu package

2018-09-17 Thread federico3
@MoKhaild123 I'll try to get the official package in Ubuntu updated. In the meantime you can pull the package from Debian (it's the source used by Ubuntu): [https://packages.debian.org/sid/nim](https://packages.debian.org/sid/nim)

Re: Elegant way to convert compiletime seq into const array

2018-09-17 Thread LeuGim
I didn't look at why this happens, just changing array to seq in constant construction results in creating in C a construct struct filled with values (numbers), and they get as is into the executable, and using array results in an assignment of each value seaparately into the run-time variable,

Re: Embedding ssl libraries ?

2018-09-17 Thread Aiesha_Nazarothi
Wow, sounds nice. Is clang mandatory, though ?

Re: Interesting idea implemented in Zig

2018-09-17 Thread Araq
> Am I understanding correctly that you want to implement BTrees for read-only > compiled "case" statements or read only mapping types? Nim's "string cases" already compile to hash lookups and could maybe use "perfect" hashing here indeed, but nobody ever complained about the performance of

Re: Elegant way to convert compiletime seq into const array

2018-09-17 Thread matkuki
@LeuGim Excellent, no size bloat! Can you please explain what is happening between my example and yours? Thanks. P.S.: I just copy my code and quickly edited it, so as you noticed with the length, I deleted too much :)

Re: Interesting idea implemented in Zig

2018-09-17 Thread cumulonimbus
> at least for error detection you can also have none of X strings Yes, the result of a minimal perfect hash is always "it is either this specific string, or none of them; you'll have to compare to this specific string to tell". The result of a non-minimal perfect hash is "its none of these