Chocolatey Package for Nim?

2016-12-24 Thread Tristano
I've Nim 0.15.2 announcement I've read that:

> For Windows we now provide zipfiles in addition to the NSIS based installer 
> which proves to be hard to maintain and after all these months still has 
> serious issues. So we encourage you download the .zip file instead of the 
> .exe file!

and in the download page:

> You can download an installer for both 32 bit and 64 bit versions of Windows 
> below. Note that these installers have some known issues and so will unlikely 
> to be provided further in the future.

I was wondering ... it's been a while that I've installed Chocolotey and use 
ChocoloteyGUI to update a number of software packages which don't provide a 
self-updater — included some languages, like Ruby, Node.js, Go, and others.

I've found a Nim package on Chocolatey, but it hasn't been updated in a while, 
and it's still at Nim v.0.11.2:

[https://chocolatey.org/packages/nim](https://chocolatey.org/packages/nim)

But I think that the idea of maintaining an official Nim-Chocolatey package 
could be a good idea for Window versions of Nim.

The only issues at hand here would be:

  1. Who's going to create/maintain it
  2. Which default setting to use in a silent installation



As for point (1), I think what we need is that there should be either an 
"official" package (maintained by Nim devs) or at least a package which has the 
official blessing of Nim devs.

Point (2) is a bit more tricky though. I think that a Nim package should only 
install Nim, its docs, ecc. Aporia and MinGW should be taken care by the users. 
For example, I don't install MinGW, I use TDM-GCC (might be a bit old, but 
seems better configured).

Chocolatey does a good job at telling users there's a new version of the 
package, installing it silently and taking care of all the boring stuff.

What's the general view on this? And, does anyone know who created the Nim 
package linked above? The only info I've found is that it was maintained by a 
user called "pine613", but his GitHub account has been discontinued.

Anyhow, the counter on Nim-Chocolatey package says it was downloaded 117 time 
for Nim 0.10.2, and 106 times for Nim 0.11.2 -- a total of over 200 downloads, 
which is rather promising if you think it was a short-lived and unmaintained 
package. 


Re: Nim in Action is now available!

2016-12-24 Thread Tristano
Hi @dom96,

I bought _Nim In Action_ a few monthes ago (it was still MEAP v.8), a few days 
after install Nim.

I didn't yet find the needed time to study it inside out — too many project to 
finish to dedicate myself full time to Nim — but from a first reading I have to 
say that the book is really great. And I really advice everyone interested in 
Nim to go ahead and get it.

Hopefully, now I'm getting a few projects out of the way and I shall dedicate 
myself to seriously explore Nim.

Can't really imagine doing it without _Nim In Action_ though!

Best regards,

Tristano (Italy)


Re: Help With Nim Static Libs on Windows

2016-12-24 Thread Tristano
Thanks Araq. In the end I guessed it was related to stdin/out because I grepped 
"fileno" into GCC's header files and it came up in the context of filesystem 
related constants.

Mhhh ... so I might be getting away with a simple Fibonacci function, but get a 
crash with more complex stuff! I've read many posts of people having problems 
importing static libs into PureBASIC under Windows, and that using DLL is 
always simpler. But in this case I was trying to experiment with static libs.

I've seen on PureBASIC forums that often errors similar to the ones I got were 
related to a missing system DLL (like some specific version of MS Visual Studio 
redistributables, ecc.) and was solved by importing the required DLLs along 
with the static libs

I guess that I'll eventually get a grip on this, with more practice and insight 
into the nebulous world of all these trans-compiler operations --- I mean: 
s many options just for GCC compiler alone! it's east to get lost in this 
configuration/compatibility jungle.

;)


Re: Please , can we stop spams?

2016-12-24 Thread federico3
I've seen flagging working well for other forums. When a comment is flagged as 
spam by N users a moderator will be able to remove the comment and block the 
account that posted it. If regular users abuse the spam flag the moderator can 
block their account instead. N=1 is probably enough to start with.


Re: GTK 3.20 Nim wrapper

2016-12-24 Thread Stefan_Salewski
> I'm confused in all that pointer-reference-object_itself stuff

I have already downloaded the source code of librsvg-2.40.16. Seems to be 
really a tiny lib, and the c headers contains not many strange macros, so 
building the wrapper should be easy. (There are bitfields used, but fortunately 
latest c2nim supports that :)

I do not understand that lib well, so testing will be some work. For example I 
still wonder about your mentioned rsvg_handle_close (). From the API 
documentation: "Closes handle , to indicate that loading the image is complete. 
This will return TRUE if the loader closed successfully. Note that handle isn't 
freed until g_object_unref is called.". No idea currently.

I think the wrapper will be finished in a few days, but maybe I will just 
ignore testing.


Re: Help With Nim Static Libs on Windows

2016-12-24 Thread Araq
Pelles C is not supported by Nim and it seems to lack `fileno` which Nim's 
stdlib depends on, might be called `_fileno` in Pelles C. I'm not sure what 
`/EXPORT:fileno` does so if you get random crashes, don't complain. :)

I would stick to DLLs for interop with PureBasic.


Re: Help With Nim Static Libs on Windows

2016-12-24 Thread Tristano
SOLVEEED!

I've solved it by telling PureBASIC compiler to pass this option to polink:


/EXPORT:fileno


I haven't yet understood what was going on. But I do understand that his option 
exports the "fileno" symbol, which was the only one left in the error reports.

Can anyone help understand why this symbol was missing, what it refers to?

Shouldn't Nim have taken care of it? Or does Nim give for granted that some C 
code importing the header files will handle it?

It seems such a small issue, yet it kept me turning in circles for quite a long 
time...


Re: Help With Nim Static Libs on Windows

2016-12-24 Thread Tristano
Hi @Krux02,

No, I didnt. PureBASIC only uses "polink" and "porc" and "polib" from the 
Pelles C -- and they seem to be from different version releases also. PureBASIC 
has its own compiler + a FASM compiler. Unfortunately the documentation doesn't 
provide much help (actually: none) when it comes to these deatails. But it says 
it should handle any C library alright -- but then, again, PureBASIC is 
cross-platform but has a single documentation, so it might be referring 
actually to Linux or Mac.

But I'll try to look into Pelles C documentation, hoping it might help.

Would you have any idea what this 'fileno' unresolved symbol might refer to? 
The other two went away when I disable debugger support in the final lib, so 
maybe this symbol could also be resolved by either including and extra 
(required) lib, or by an extra compiler option of sorts...

B.R.


Re: Please , can we stop spams?

2016-12-24 Thread Krux02
I think moderator approval of first posts by users is the best solution so far. 
Not too much work for moderators, and no change for anybody who is already on 
the board, except no new spam anymore. Flagging is not the best idea. I think 
currently it means that all active users have to flag something before anything 
happens (rough guess of active users at the moment), and when there are a ton 
of users, flagging gets abused to remove unwanted content that has nothing to 
do with SPAM, it is just an unpopular opinion.


Re: Help With Nim Static Libs on Windows

2016-12-24 Thread Krux02
Ok, I have never used Pelles C nor PureBasic (I did some BlitzBASIC 10 years 
ago if that counts). So my answer is just guessing around. Since PureBasic 
seems to be integrated with the pelles C compiler, did you try to also compile 
the nim intermediate code with that compiler to a static library? I could 
imagine that it might help.


Help With Nim Static Libs on Windows

2016-12-24 Thread Tristano
Hi everybody,

this is my first post here — nice to be onboard!

I've been experimenting with Nim and I really enjoy it.

I'm working under Win 10 x64. I don't use MinGw compiler suggerst by Nim 
installer, I instead use TDM-GCC, which is working very well.

I've tried to create libraries with Nim to use with another language: 
PureBASIC. So I started with the Fibonacci example from the documentation.

With the DLL everything went fine: compiled, imported the DLL in my PureBASIC 
code and I've accesed the fib() function from the DLL easily.

With the static library I'm experiencing some difficoulties and I really don't 
know what else to try. I am no C expert, nor I know deeply GCC, but so far I've 
managed to compiler quite a few C projects without problems.

PureBASIC can include C libraries with either stdcall (the default) as well as 
not stdcall -- it auto-decorates them, the former as _FunctionName@callsize, 
the latter as _FunctionName. But on x64, it has only one calling convention 
(stdcall, I seem to understand).

It can import function from a library (.lib) or an object (.obj) file.

When I try to import the static lib functions I get an error from Pelles C 
polink (used by PureBASIC compiler):


POLINK: Unresolved external symbol 'fdopen'
POLINK: Unresolved external symbol 'fileno'
POLINK: Unresolved external symbol ''__strtod'



I am compiling the Fibonacci Nim example with:


nim c --app:staticLib --noMain --header fib.nim


And I get a "fib.lib" file -- which I gather should be the static lib, not 
needing any dependencies.

I've tried changin in the Nim source the "exportc" pragma:


proc fib(a: cint): cint {.cdecl, exportc.} =
  if a <= 2:
result = 1
  else:
result = fib(a - 1) + fib(a - 2)


and:


proc fib(a: cint): cint {.stdcall, exportc.} =


But both failed...

What am I missin out/doing wrong?

Any hints to unlock the situation and set me in the right direction would 
really help!

Thanks

Tristano (Italy)