# nim c -f --cc:zig --zig.options.linker:"-target arm-linux-musleabihf"
--zig.options.always:"-target arm-linux-musleabihf" hello.nim
command line(1, 2) Error: unknown C compiler: 'zig'. Available options are:
gcc, switch_gcc, llvm_gcc, clang, bcc, vcc, tcc, env, icl, icc, clang_cl
Did you try adding closure annotation the suspect procs yourself? If it works,
you could create a pull request.
Hi,
I would like to use Nim for javascript related work, and I wonder how I can use
event handlers in Nim when the proc I want to register is a closure. Often, the
event needs to access external data and gets the `{.closure.}` annotation, and
I get the following error from the compiler:
This should be enough, you can capture whatever type you want inside a closure.
type
Publisher = ref object
subs: seq[proc(data: int)]
Run
The publisher has to maintain the list of subscribers.
It's easy to implement if all the subscribers are of the same type (or of the
multiple pre-defined types).
But is it possible to do not specify all possible types of subscribers?
You can implement atomic refcounting with destructors. See what I do in my
[multithreading
runtime](https://github.com/mratsim/weave/blob/33a446ca4ac6294e664d26693702e3eb1d9af326/weave/cross_thread_com/flow_events.nim#L176-L201):
type
FlowEvent* = object
e: EventPtr
I've been fighting with inheritance + generics in the past to implement layers
of neural networks.
I think your example wouldn't work if a `Dog[Domestic]` and a `Cat[Domestic]`
are stored in the same datastructure or if you use the value through a proc
declared in another module.
In the end,
Off-topic: is there the equivalent of a "when case"?
I like that nim checks for missing scenarios when writing "case" statements.
I like that nim allows for compile-time code decisions with "when" directives.
Putting those together would be spiffy. Not a top-tier feature by any means,
but it
After many many hours of trying to make this work, I finally got it to go. I
suspect I'm not the only person to struggle with this, so I figured I'd
document the answer here.
Rather than getting into theoreticals, let's just jump into code.
Nim supports inheritance for objects. An example:
Turns out that this issue was because of some mixup in the LD_LIBRARY_PATH.
Once was was fixed, the nim program built with even g++ 9.1.0 links fine with
the external_lib_64.so built with g++ 6.3.0.
Hi, Does Nim have some good ways to handle shared memory? The only way I found
was manual memory management, but that can't handle inner references and,
hello, that's the reason I'm using a garbage collected language in the first
place :D The experimental manual says that the parallel statement
Hello,
Today I came across this run time error when running a nim compiled program
that dynamically linked with an external c++ library .so (let's call it
`external_lib_64.so`)
could not load: external_lib_64.so
compile with -d:nimDebugDlOpen for more information
Good news:
It worked perfectly !!
Thanks to both!
hello:-d:useMalloc|
---|---
I feel like I'm faster, is true
Hello, thanks for answering
I compile and link in this way
$ (MY_LIB_NIM): * .nim Makefile
nim c -d: release --passC: -fPIC --noMain --opt: speed --app:
staticlib --outdir: $ (NIM_OUTDIR) --nimcache: $ (NIM_CACHEDIR) --out: $
(basename $ < ) .a --header: $ (basename
Do you compile to shared library? Things to check: You do call NimMain or
setupForeignThreadGC.
Another thing I recommend trying is to compile with \--gc:arc -d:useMalloc this
gives you garbage collection free environment that will ease integration with
postgres.
Hello everyone
I am trying to integrate two server side test functions with Postgres the first
one, nimAddOne (int): int works fine integrate it like this:
# AddOne adds one to the given arg and retuns it
proc nimAddOne (i: cint): cint {.exportc.} =
result = i + 1
change terminal key
> ATTN PROC CALL Keyboard simulation done by the program and not by the keyboard
→ ATTN keyboard simulation →Passes program name to application server → PROC
keyboard simulation →Transmits the name of the procedure to be executed in
Internal → CALL keyboard simulation
Regarding multithreading it really depends on your workload but here are 2
kinds of code architectures that would allow mixing async on threads:
1\. If the part of your code that you want threaded is stateless and only
allows the following types to crossover threads:
* plain old
> So along with being a neat and clean logo it also encapsulates the roots and
> initial goal of Nim.
Agreed. Unfortunately, most people -- especially outside of the community --
don't know that. It doesn't get across as what it is supposed to mean and
that's not good communication.
20 matches
Mail list logo