Advent of Nim 2021

2021-12-09 Thread guaracy
Ok, an opportunity to learn Nim.




Could not run program which compiling with static linked lib

2021-12-09 Thread Yardanico
In Nim you also need to do `--dynlibOverride:"pq"` to tell Nim to not try to 
dynamically load a library if the wrapper uses the `dynlib` pragma, see the 
bottom of the 

 section.


Advent of Nim 2021

2021-12-09 Thread pointystick
Here's my repo:




More nim newbie woes, this time echo fmt Possible AOC2021 spoiler

2021-12-09 Thread freeflow
I can make State an object. Does it really need to be exported as it is used 
only within the module in which it is declared.


More nim newbie woes, this time echo fmt Possible AOC2021 spoiler

2021-12-09 Thread Araq
Make `State` an `object` and export it via `*`.


Could not run program which compiling with static linked lib

2021-12-09 Thread geohuz
I'm using docker to cross compile from my macbookpro.


Could not run program which compiling with static linked lib

2021-12-09 Thread treeform
I don't think you can just statically link libpq.so, you need libpg.a - static 
library file. I don't think `apk add postgresql-dev` gives you that, I think it 
only gives you the dynamically linked one. For static linking you probably 
would have to build libpq.a yourself from source. Libpq is a huge library you 
will also have to figure out two to deal with its dependencies: ssl, crypto 
zlib, iconv, ... I think it's going to take a long time to figure out.

If you are using docker why care about static linking?


Could not run program which compiling with static linked lib

2021-12-09 Thread geohuz
I'm trying to static link postgresql libpq with my program which connects to 
postgresql server, here is my docker file:


FROM nimlang/nim:alpine

RUN apk add --no-cache postgresql-dev

ENTRYPOINT ["sh", "-c"]


Run

build:


docker build  -t pgcompile .


Run

compile:


docker run --rm -v (pwd):/mypgclient  -w /mypgclient pgcompile "nim c 
--passL:'-static' --passL:'-lpq' -d:release -d:danger -d:nimDebugDlOpen 
mypgclient"


Run

This compiles successfully, but I got error:


Dynamic loading not supported
could not load: libpq.so(.5|)


Run

What is the problem?


Show Nim: Forematics is a Metamath verifier written in Nim.

2021-12-09 Thread treeform
Pure math is a goal in itself. I mainly written this because it looked like 
fun, and to brush up on my math skills.


C++ bindings - m_type issue

2021-12-09 Thread rnd83
Or - as the error message states - StandardTransient must be '= object of 
RootObj' instead of '= object'. Maybe Handle as well?!


How would I port such project to nim?

2021-12-09 Thread Araq
In order to generate it, you first have to understand what to generate.


More nim newbie woes, this time echo fmt Possible AOC2021 spoiler

2021-12-09 Thread freeflow
@Araq. Thanks for taking the time to respond. I can confirm that there is no 
such item as BoardsAsNumbersrnalErrorFlag in my AoC2021 project. I do have a 
field in a module level tuple that has part of the same name. I'm happy to post 
a link to the repository if that's helpful.


State = tuple
Data: seq[string]
DrawnNumbers:seq[int]
BoardsAsNumbers:seq[seq[seq[int]]]
Boards:seq[Board]
Win:bool
Answer:int


Run


thriftcore - Apache Thrift primitives

2021-12-09 Thread icedquinn
Clocked in seven hours (may have been some distractions) and have the generic 
protocol object and method interface in. Also wrapped the compact encoding 
format with it. Will need to do the same with THeaders and get some test code 
going.

That leaves the IDL generator and the actual communicating over the network 
stack. Which is partly out of scope but will probably have to work something 
out anyway. Add some testing and that should do it for having an RPC framework 
in Nim :thumbsup:


How would I port such project to nim?

2021-12-09 Thread icedquinn
aren't you intended to generate this boilerplate from an interface spec when it 
comes to COM?


More nim newbie woes, this time echo fmt Possible AOC2021 spoiler

2021-12-09 Thread Araq
No. It's more likely you forget an export `*` marker for 
`BoardsAsNumbersrnalErrorFlag`.


More nim newbie woes, this time echo fmt Possible AOC2021 spoiler

2021-12-09 Thread freeflow
I've got day04 code than is now 'clean' in VSCode by changing from echo fmt to 
just echo. However I'm still seeing the compiler error out with 


[Running] nim compile --verbosity:0 --hints:off --run [Running] nim compile 
--verbosity:0 --hints:off --run 
"c:\Users\*\source\repos\AoC2021\Nim\Sources\Main.nim"
C:\Users\*\.choosenim\toolchains\nim-1.6.0\lib\core\macros.nim(533, 3) 
Error: undeclared identifier: 'BoardsAsNumbersrnalErrorFlag'
candidates (edit distance, scope distance); see '--spellSuggest':
 (13, 2): 'internalErrorFlag' [proc declared in 
C:\Users\*\.choosenim\toolchains\nim-1.6.0\lib\core\macros.nim(525, 6)]


Run

Should I raise this as a compiler issue?


More nim newbie woes, this time echo fmt Possible AOC2021 spoiler

2021-12-09 Thread freeflow
@shirleyquirk That's what I would normally try to do, particularly if I was 
playing in VBA (my normal amateur hunting grounds). With nim it seems to me 
that the echo fmt error is related to an mistake that has been made far far 
away so tracking down a concise example can be difficult for a nim newbie like 
myself. I know some forums, like stack overflow, don't like links, but would it 
be acceptable here to post a link to a git repository?


Nim's version of the Trojan Source vulnerability

2021-12-09 Thread kobi
so, I was reading today that the dart language solves this issue in this way: 
The compiler issues a warning about any such invisible characters in a literal 
string. 



Show Nim: Forematics is a Metamath verifier written in Nim.

2021-12-09 Thread kobi
Just out of curiousity, if you don't mind sharing... have you written this 
project, just out of interest, or does it serve as a step in a more practical 
goal?


How would I port such project to nim?

2021-12-09 Thread Araq
See  for an 
example how to deal with COM with `nim c`. With `nim cpp` it is probably easier 
but I don't know the details.