i used c2nim with importc but no header pragma ... maybe is that my problem.
will try it later.
thx
Nice! It's libraries like this make a language "batteries included". Good job.
It looks like xmlparser uses parsexml. I think it boils down which API is more
convenient for your use case. Probably xmlparser.
If you have a choice use JSON.
I don't understand your question really, are you looking for a library that
transforms Nim code into C/Java/C# code? Are you looking for a library that
evaluates Nim code during runtime?
How do you import a constant over FFI?
This works:
var PI {.importc.}: cdouble
Run
This doesn't (Error: 'let' symbol requires an initialization):
let PI {.importc.}: cdouble
Run
Nim's db-api is nice but unfortunately the prepared statement is not exposed
(so no bulk bind/fetch possible). You could call sqlite's internal
"sqlite3_next_stmt" to see which preparedStatement is still open and not
finalised and close these statements manually.. The runtime-error you are
it could be a bug. if there are still some statements open (unfinalized) you
will get this error while trying to close the db. I have started to develop an
interchangeable sqlite-api a while ago (I use it for some tooling ) -
unfortunately the work is pending because I like to finish the
That link is helpful, thank you. For anyone else who hits this, I added these
two lines after the imports:
when defined(windows):
{.passl: "-lz".}
Run
It now compiles & runs & lists zip contents on Windows and Linux. And the
executable doesn't seem to depend
I have a question, is there any library implementing nim-lang as evaluator to
the c++/c/java/c#?
You better know the tool you're working with. Check "INSERT OR IGNORE ..." and
"INSERT OR REPLACE..." statements.
nim does not substitute for SQL statements
That's a poor error from Nimble, can you report this as an issue? IMO we need a
better error message here.
See
[https://forum.nim-lang.org/t/5353](https://forum.nim-lang.org/t/5353)
(I just asked google)
Alright, I thought SQL gracefully ignored adding a duplicate key but guess not.
I've added this function:
proc exists(database: Database, id: string): bool =
result = if len(database.db.getValue(sql"SELECT id FROM Pages WHERE id =
?;", id)) > 0: true else: false
Use an `if` statement instead, `case` is mostly for exhaustive enumerations.
On both Linux and Windows `nimble list -i`'s output includes: `zip [0.2.1]`.
On Linux the program listed below compiles & runs & lists a zip file.
On Windows I just get error messages (shown after the program).
nzip.nim
{.experimental: "codeReordering".}
import os
you want to insert the same thing twice then you have duplicate keys you should
read a simple book on sql ;) it doesn't have the wrong program but knowing SQL
would have allowed you to avoid this kind of error.
I'm new to SQL so don't know if I'm doing something wrong or this is a bug.
The following produces runtime error: "Error: unhandled exception: unable to
close due to unfinalized statements or unfinished backups [DbError]"
The code is mostly adapted from 'Nim in Action'. The first run on db
I write a simple excel reader.It can read xlsx file, support some basic
operators. Still WIP.
[https://github.com/xflywind/xlsx](https://github.com/xflywind/xlsx)
You can read docs in
[https://xflywind.github.io/xlsx/xlsx.html](https://xflywind.github.io/xlsx/xlsx.html)
`parseExcel` to get
Thank you very much, dawkot. So I've ended up with something like this
import macros
import strutils
import strformat
export actors
### Entities
type
ent* = object
id*:
Very likely the of-branch cannot evaluate iterator and/or template. The `..<`
not defined as proc, the workaround is
template test(v: typed) =
case v
of low(int) .. pred(5):
echo "under 5"
else:
echo "5 or above"
Run
I'm messing around with templates and can't get passed this template/generic
instantiation of 'test' from here. What is wrong with this code?
let val = 10
template test(val: typed) =
case val:
of low(int)..<5:
echo "under 5"
else:
Dumb mistake. I fixed the issue by copying the entire uncompressed directory to
somewhere and adding nim-1.0.4/bin and ~/.nimble/bin to my PATH as described in
the install page and that fixed the issue.
23 matches
Mail list logo