Double pointer FFI to C

2022-10-23 Thread elcritch
Glad to help! > update: FIXED: it required NULL-terminated array what could be the best way > to pass pointer of cstrings/strings array There's a helper in the stdlib type for arrays of C strings: If you look in the system module there's

Double pointer FFI to C

2022-10-23 Thread inv2004
Thank you @elcritch Can I another question: * what could be the best way to pass pointer of cstrings/strings array // C: f(char *attrs[]) proc f(attrs: ptr cstring) {.importc.} var attrs = ["1".cstring] f(attrs.addr) // or attrs[0].addr => both fails

Nim 2: What’s special about Task?

2022-10-23 Thread snej
That snippet seems way more complex than necessary. It's reimplementing what a closure/lambda already does, which is to copy its context along with the function pointer. Why would it be necessary to do that by hand when Nim already has closures?

Double pointer FFI to C

2022-10-23 Thread elcritch
> Is it possible to make it without additional LdapInit structure but without > ptr ptr also? Yes, you can use `addr`. Looks like this is what they do in C according to [stackoverflow](https://stackoverflow.com/questions/16396926/binding-and-authenticating-to-an-ldap-server-over-ssl-and-tls).

Where to start with creating direct Qt bindings?

2022-10-23 Thread filcuc
Disclaimer: i'm the author of `NimQml ` Did anyone give it a try? why wrapping all Qt when you have the Nim standard library? Qt is full blown framework because there wasn't one for C++ at the time and the C++ standard library lacked of a lot stuff (networking,

Newbie first impressions

2022-10-23 Thread dlesnoff
You are critic, but you don't say in which way it is `suboptimal`. What are precisely the good designs you want to add to Nimble ? Have you opened Issues in that sense ?

Newbie first impressions

2022-10-23 Thread bpr
You're right, the OpenSSL problem is with Nimble, not Nim the language. Unfortunately, the language, which I happen to like, will be judged by the ecosystem. Someone said "Copying bad design is not good design", a rather obvious and unhelpful slogan IMO. How about copying good designs? For all

Nim 2: What’s special about Task?

2022-10-23 Thread auxym
I enjoyed Araq's talk, but I also had the same question. How is Task different than wrapping a proc in a closure that includes its arguments, then passing that closure around as an object? Ringabout/flywind posted the following on discord: > Yeah, let x = toTask(hello(521, "123")) is roughly

Nim 2: What’s special about Task?

2022-10-23 Thread Zoom
I don't think we missed anything as it looks like just a syntax sugar for some routine manual work such as declaring a type to pack your arguments in. So, mostly a bit of a convenience and nothing conceptually new. Just tried and rewritten a multithreaded process executor from a couple of

Newbie first impressions

2022-10-23 Thread dlesnoff
First, it is always hard to define our expectations in terms of newcomers. People that have never learned any programming language, but uses Linux ? Should we target children, that had barely CS/Mathematics lectures ? People also have different objectives in programming, so making tutorials

Nim 2: What’s special about Task?

2022-10-23 Thread planetis
I think the whole point of the talk was to inform us about what changed. And Task is way different than what createThread and threadpool did. I guess it's more oriented to library authors, showing how it can be used. For me though I have no clue yet how isolated fits into that scope.

Newbie first impressions

2022-10-23 Thread aniou
In the same case I was able to build tools with `/koch tools -d:sslVersion=3`. It was documented, but not as straightforward as it should be, to be convenient.

Double pointer FFI to C

2022-10-23 Thread inv2004
I think that I found answer overnight: low level FFI just with ptr, but a bit higher level looks the ptr and do free if necessary The main point was not to pass high level value, but pointer for it, so the final result is: type LdapInt = object type Ldap = object r: ptr

Newbie first impressions

2022-10-23 Thread Clonk
> I mean, who uses Ubuntu, right? This openSSL occurs on Ubuntu 22.04 as well. And yeah it's annoying. It's also worrying to ask the user to downgrade sytem security library. This type of problem where things don't work out of the box and you need to tinker a bit are very common in many

NimConf 2022 - Saturday, October 22nd

2022-10-23 Thread pietroppeter
Had time to catch up with the talks I had not yet watched, and it was a great nimconf. Thanks to Nim team for organizing and to all other speakers to produce such great content! And although I was not there, there are multiple reports (check #nimconf channel on discord) of Tim Sweeney

Newbie first impressions

2022-10-23 Thread xigoi
I believe that any good tutorial for a programming language, unless it's meant for children, should start with console programs. That way you actually learn the language and not a specific library.