How to remove the N_LIB_PRIVATE from exported c code.

2024-04-01 Thread ringabout
See also => dynlib keeps exported functions alive in emscripten

NVIDIA uses Nim!

2024-04-01 Thread hyu1996
This is really good news. Today is not April Fools' Day, so I believe it is true.

Am iterating over this sequence correctly?

2024-04-01 Thread janAkali
It's not clear from this snippet what are `getPolygon()` and `LevelObjectEntity` really are and what they do. But idiomatic code would look something like this: type Vertex* = tuple[x, y: int32] Polygon* = object of RootObj vertices*: seq[Vertex] fill*: L

Wasm3 (nim library) how to run c functions

2024-04-01 Thread ElegantBeef
When calling procedures you need to marshal the data from the host to the environment and vice I have an example of host to client is the wasm module t

Wasm3 (nim library) how to run c functions

2024-04-01 Thread Nlits
I have a c function: N_LIB_EXPORT N_CDECL(NCSTRING, add_nfunc)(NCSTRING* nfuncsX60flatArgs__p0, NI nfuncsX60flatArgs__p0Len_0); Run That is compiled to wasm successfully. I also am pretty sure I have the `loadWasmEnv` and `findFunction` part down. The thing I can’t wr

How to remove the N_LIB_PRIVATE from exported c code.

2024-04-01 Thread ringabout
Neat macros! Let me see whether I can make `__attribute__((used))`/`EMSCRIPTEN_KEEPALIVE` into `nimbase.h`

a template to declare an enum

2024-04-01 Thread dwhall256
Thank you both. For my needs, I must be able to specify the enum values; so I created the sequence of `nnkEnumFieldDef` to give to `newEnum()` which involved copying leaves of the `Asgn` node. For future me: `dumpTree` is your friend. For other learners, here is what I came up with. For curren

How to remove the N_LIB_PRIVATE from exported c code.

2024-04-01 Thread ElegantBeef
I am generally of the view packages should only be on a package registry if they're of sufficient quality. Which means have tests, and documentation. Since Nimble is decentralized there is not much reason to add what I consider incomplete packages.

Attempting a DSL on top of htmlgen for fun/learning

2024-04-01 Thread RegularAlias
So far this is what I've got: import macros, htmlgen macro traverseTree(body: untyped): untyped = proc processNode(node: NimNode): NimNode = case node.kind of nnkCall: let callee = node[0] var children: seq[Nim

help with channels and threads

2024-04-01 Thread ggibson
> The logic in your loop will try and submit... Ah good catch with the `while workID < NSUBMISSIONS` submission loop, Thank you! I tried too hard to make a tidy minimal example and introduced this bug thinking I could get rid of my break condition for cleanliness. Edited the code and output abo

How to remove the N_LIB_PRIVATE from exported c code.

2024-04-01 Thread Nlits
Is there any reason why your wasm3 package is not on nimble? I was going to make my own wasm runtime wrapper, but now that I know one exists I don’t need to. As for the emcc keep alive thing, I will see if I need to use it. (I might)

How to remove the N_LIB_PRIVATE from exported c code.

2024-04-01 Thread ElegantBeef
If you're sharing code with other languages the correct annotation is `cdecl, exportc, dynlib` though in many cases `nimcall` is compatible with `cdecl`

How to remove the N_LIB_PRIVATE from exported c code.

2024-04-01 Thread Nlits
**Successful: (with dynlib pragma)** N_LIB_EXPORT N_CDECL(NCSTRING, add_nfunc)(NCSTRING* nfuncsX60flatArgs__p0, NI nfuncsX60flatArgs__p0Len_0); Run WAST: (export "add_nfunc" (func $52)) Run 👍

How to properly make a static type-checking macro?

2024-04-01 Thread ElegantBeef
> Note: There is also an issue with the return arg saying that arg is unused? You do not have a return type it should be `: untyped`. Is there a reason for you to use a macro here, a template works just fine. template typeCheck(arg: typed, typ: typedesc): untyped = when arg is

help with channels and threads

2024-04-01 Thread elcritch
There are a couple of logic flaws in your job pool example which are causing your issues. Nothing particularly Nim specific, but here's a breakdown. while workID < NSUBMISSIONS: # This will run ceil(NSUBMISSIONS / NTHREADS) * NTHREADS items for thread in pool.mitems:

How to remove the N_LIB_PRIVATE from exported c code.

2024-04-01 Thread Nlits
Should I use just exportc and dynlib or should I use cdecl as the docs say too?

How to properly make a static type-checking macro?

2024-04-01 Thread Nlits
> You do not have a return type it should be : untyped. I had `: typed` there but the compiler bugged me to remove it as it was the default?

How to remove the N_LIB_PRIVATE from exported c code.

2024-04-01 Thread ElegantBeef
You should use `exportc, dynlib` to ensure a procedure is not dead code removed. Depending on your wasm compiler you may also want to use `codegenDecl` to add the correct annotation to your procedure.

help with channels and threads

2024-04-01 Thread ggibson
I've spent a few days on this and boiled this down to a minimal example. Can an expert with Nim parallelism please tell me where I'm going wrong here? Output changes from run to run (is stochastic) but I did not intend that and do not see how this can be. Here are several runs in a row of a very

How to remove the N_LIB_PRIVATE from exported c code.

2024-04-01 Thread Nlits
I am using the `exportc` pragma to attempt to export to c then WASM, but the function never appears in the WASM and is generated with `N_LIB_PRIVATE` in the c code. Is there anyway to remove this or am I getting the cause of my issue completely wrong? (I found in the c code only the functions wi

NVIDIA uses Nim!

2024-04-01 Thread Charles
This is a roller-coaster of emotions.

How to properly make a static type-checking macro?

2024-04-01 Thread Nlits
With my current code I keep on getting typeDesc and type instead of both of them being types. How do I fix this specific issue or is there already a better implementation? macro typecheck*(arg: typed, typ: typed) = ## Type check a proc name with args to types let

Am iterating over this sequence correctly?

2024-04-01 Thread ninovanhooff
I'm trying to modify a sequence in-place by modifying the values without copying the data. This worrks, but I wonder wether I'm doing it in an idiomatic 'Nim' way, rather than trying to use `ptr` too much. I feel the answer should be here, where it is suggested to use `ref`. Not sure how to ge

NVIDIA uses Nim!

2024-04-01 Thread Niminem
You got me. Bastard

How to use dynamic dispatch with inheritance without converting to the appropriate subtype by hand?

2024-04-01 Thread 4n0n4me
error message says: (line numbers are not the same as in your code) /usercode/in.nim(21, 8) Warning: use {.base.} for base methods; baseless methods are deprecated [UseBase] /usercode/in.nim(24, 8) Warning: use {.base.} for base methods; baseless methods are deprecated [UseBase]

How to use dynamic dispatch with inheritance without converting to the appropriate subtype by hand?

2024-04-01 Thread Isofruit
You also need to provide a base "default" implementation for `Foo` like so: method showContents(b: Foo) {.base.} = raise newException(CatchableError, "Not implemented") Run

How to use dynamic dispatch with inheritance without converting to the appropriate subtype by hand?

2024-04-01 Thread Charles
Can't believe I didn't think to do that :facepalm: The docs even had one like that but I assumed it wasn't needed for some reason. Thank you both.

How to use dynamic dispatch with inheritance without converting to the appropriate subtype by hand?

2024-04-01 Thread Charles
Hello again, I have the following situation, with a myFoo variable of type Foo that is instantiated as one of the foo subtypes: type Foo = ref object of RootObj x: string = "I'm Foo" Bar1 = ref object of Foo y: string = "I'm Bar1

Problem to understand an exception

2024-04-01 Thread MauroG
Hi to all. I add new tests done and now the problem is clearer but I still don't have a solution: In my code, as suggested by @janAkali let client = newHttpClient(sslContext = newContext(protVersion = protSSLv23)) Run and compiled with this command: nim c -d:ssl -d

NVIDIA uses Nim!

2024-04-01 Thread UxDnz0
What are you talking about, this all new grasshopper chipset has all the bells and whistles you've come to adore; Thousand pages of documentation, three variations depending on if you're left brained, right brained, or frustrated by the lack of evidence for either. On-board AI powered hallucinat

NVIDIA uses Nim!

2024-04-01 Thread KhazAkar
Delet dis

NVIDIA uses Nim!

2024-04-01 Thread nimian
For anyone wondering this is April 1st and NIM here stands for Nvidia Inference Microservice

a template to declare an enum

2024-04-01 Thread Isofruit
To be more specific to what araq stated: Make your life very easy and use the `newEnum` proc (which can only be used inside macros) which does exactly what you want to do here - just not in a way that can be called from normal code and needs you to wrap it in a macro.

Trucluco Gummies – Blood Support Gummies: Ingredients, Work & Cost!

2024-04-01 Thread balmorexuse
Trucluco Gummies is a dietary improvement with an obvious and prohibitive blend of normal trimmings. The producer of Trucluco Gummies asserts that its part isolates it from various improvements in the glucose prosperity industry. Trucluco Gummies contains a blend of cost maqui berries and other

Balmorex Pro Cream & Its Real Benefits (USA & Canada) Reviews 2024

2024-04-01 Thread balmorexuse
Balmorex Pro is a relief from discomfort cream planned by a specialist and expertly tried to give effective help from joint inflammation, back torment, strains, and joint and solid distress. It has an exceptional, protected oxygenated oil that eases torment in a split second and diligently for a

I'm starting to live stream my game project written in Nim

2024-04-01 Thread KhazAkar
While we're at it - I'm streaming rarely my coding in Nim on Twitch, like code wars.com or exercisem.org katas

NVIDIA uses Nim!

2024-04-01 Thread Araq
Nim is spreading like wild fire inside NVIDIA! But see for yourself: The device drivers for their new upcoming "grasshopper" chip have all been written in Nim!

a template to declare an enum

2024-04-01 Thread Araq
No, use a macro.

Problem to understand an exception

2024-04-01 Thread MauroG
Yes Mabon, I already compile with -d:ssl