Cross compilation to Windows, linker error (unrecognized option '-z'

2024-03-28 Thread scippie
> There used to be a similar issue with the Fedora version of the package (when > it was still available). I switched to choosenim (which ships the official > version of the config files) once noticing it Maybe I should do the same... Thanks for reminding me of choosenim, I had forgotten it exi

Cross compilation to Windows, linker error (unrecognized option '-z'

2024-03-28 Thread scippie
Yes! It works! Thanks janAkali! > I will!

Cross compilation to Windows, linker error (unrecognized option '-z'

2024-03-28 Thread scippie
Thanks for the tips. The search continues...

Cross compilation to Windows, linker error (unrecognized option '-z'

2024-03-28 Thread scippie
> I see, it seems like the old problem is still here. ;) Here are my all > arguments for cross-compile: > > nim c -d:mingw --os:windows --cpu:amd64 > --amd64.windows.gcc.exe:x86_64-w64-mingw32-gcc > --amd64.windows.gcc.linkerexe=x86_64-w64-mingw32-gcc Still gives the same error. This works fo

Cross compilation to Windows, linker error (unrecognized option '-z'

2024-03-28 Thread scippie
> Out of curiosity, what happens when you add two more flags: --cpu:amd64 and > --os:windows? Very strange, that makes it use gcc instead of mingw (although I specified the d:mingw option) which doesn't work of course. The errors shown are that it can't find io.h and windows.h, but the last lin

Cross compilation to Windows, linker error (unrecognized option '-z'

2024-03-28 Thread scippie
> But it seems to not be the case. I now think it's one of your dependencies > that adds it. Are you talking about the imports I use? Because I find it strange that they would influence the compiler arguments. Anyway, to prove that it doesn't have to do with that, I made a simple hello world an

Cross compilation to Windows, linker error (unrecognized option '-z'

2024-03-27 Thread scippie
> See > . Sorry if this sounds completely dumb, but that post talks about ld on Windows in msys2 (which they tell does not support -z), but I am working on Linux. Also, if -z is not supported (on mingw), why does the Nim

Cross compilation to Windows, linker error (unrecognized option '-z'

2024-03-27 Thread scippie
I work with Arch Linux and Nim works great on it. Now I want to build a binary to test on a Windows device, so I wanted to cross-compile it. I followed the instructions on When I build my program, I get errors at [Link]

How do you handle incomplete nimble packages?

2024-03-25 Thread scippie
Ok, this was just a question about how others handle the nimble packages. This was not at all a rant or whatever. Some answers made good points, but nothing (coming from me at least) was meant as negative or generalization or whatever. The example stb_truetype was simply an example to make a poi

How do you handle incomplete nimble packages?

2024-03-25 Thread scippie
I just tried to do a wrapper without futhark, with {.importc.} and things like that, and that worked good too. I think I prefer a method with less dependencies, so I may stick with that, but we'll see :-) Thanks for all the great answers guys!

List of GC'ed types

2024-03-25 Thread scippie
Either that, or the environment is passed as extra parameters, in which case no clean up should be necessary, but you're right, it will probably be something like that and we should not worry about it.

How do you handle incomplete nimble packages?

2024-03-25 Thread scippie
> You might have a better experience with Futhark - > It's a tool that generates complete > bindings to C libraries automagically. I just tried this and it works like a charm! I replaced both stb_image and stb_truetype with this, had to rewrite the code a bit

How do you handle incomplete nimble packages?

2024-03-25 Thread scippie
> Sorry as a hobbier I can only say these useless things. No, you're right. We can only all try to contribute to make Nim as big as the others. The sad part is that those other languages usually have companies behind them pushing them upwards (and not always doing the language any good on the l

How do you handle incomplete nimble packages?

2024-03-25 Thread scippie
> Nimble index needs cleaning of missing repos. Yes, so it seems. I am totally in love with Nim itself, but at this point it feels like the Nimble index should be cancelled or managed by someone (which you can't expect from anyone to do for free). But the way it is now gives newcomers a false

How do you handle incomplete nimble packages?

2024-03-25 Thread scippie
> You might have a better experience with Futhark - > It's a tool that generates complete > bindings to C libraries automagically. Thanks for the link. Like I mentioned, I need to learn to create my own bindings yet, still in the process of learning Nim. It f

List of GC'ed types

2024-03-25 Thread scippie
I'm still learning Nim, so maybe I am not seeing enough details, but I find this table to be logical. I do have a very strong C/C++/ASM/... background, and have long ago written my own Turbo Pascal compiler so maybe that's why I see it that way. Things like a seq and string are objects that are

How do you handle incomplete nimble packages?

2024-03-25 Thread scippie
I understand and I think I agree. But... how do you then handle it? You only use your own wrappers and don't use external ones?

How do you handle incomplete nimble packages?

2024-03-25 Thread scippie
Let me start with an example: I wanted to build a graphical bitmap of a font with the basic ASCII characters for some retro testing development. Still learning Nim so these projects are easy and fun to work on. I wanted to use a specific mono spaced font, so I downloaded a TTF and wanted to ren

About a VFS library

2024-03-24 Thread scippie
If you don't specifically need a real VFS, you can always create an SQLite database with a simple table containing a filename and a blob containing the data. If you need more things like creation/modification date/time, you can add those columns too. You can even add a deleted column/flag if you

Issues with identifier equality and FFI

2024-03-21 Thread scippie
Oh ok, that's strange, because GL_UNSIGNED_BYTE worked, I never thought of looking for something like cGL_FLOAT. But it works, thanks! I maybe should have checked the sources first before asking here, but the errors didn't make me think that way. It seems both GL_UNSIGNED_BYTE and cGL_UNSIGNED_

Issues with identifier equality and FFI

2024-03-21 Thread scippie
> Should be fairly simple to solve, but first off, which bindings to you use? Sorry, what do you mean with that question? Do you mean which imports I use? Because that's the basic opengl package installed with nimble.

Issues with identifier equality and FFI

2024-03-21 Thread scippie
I am working on integrating OpenGL in a Nim project while I am still learning Nim. As I am still waiting on the arrival of the book, I hope I am not asking something that is addressed in the manual but I haven't found yet (although I DO hope there is a solution of course). But at this moment, i

How to preallocate cstring for FFI call that fills it up

2024-03-18 Thread scippie
For completeness: I had to reduce the length by 1 because OpenGL returns the length including the 0 character, making the string contain two 0 characters at the end. >From >: > GL_INFO_LOG_LENGTH > > params returns the

How to preallocate cstring for FFI call that fills it up

2024-03-18 Thread scippie
> ... Which indirectly states "Hey you can use Nim strings as Cstrings anywhere > you can do char* or char*, SomeInt len in C" That's great information, thanks. > ... they're nil terminated, but there is no certain way to retrieve length > from a cstringarray Feels like a flaw to me... I can f

How to preallocate cstring for FFI call that fills it up

2024-03-18 Thread scippie
> A C program would record the amount of memory it allocates, because there's > no way to retrieve this information. A traditional method is to use zero or > null as the last element (which is why Nim cstrings end with 0), but it hurts > speed. I am not sure what you are trying to tell me. I kn

How to preallocate cstring for FFI call that fills it up

2024-03-18 Thread scippie

How to preallocate cstring for FFI call that fills it up

2024-03-17 Thread scippie
I am trying to create some types/procs to be able to use OpenGL functionality in Nim. I started with the Opengl Program object. I created a proc that compiles a vertex and fragment shader, then links it into a program and stores the id in the Program object. This works. But to perform some erro

Custom type conversion

2024-03-13 Thread scippie
> Certainly not very "Nim like". That sentence made me look at what I was doing again and I think you are right (whether or not it was what you meant to say), so I am changing my approach a bit. Thank you all for your great answers. I have learned a lot today!

Custom type conversion

2024-03-13 Thread scippie
> You don't have to write your own to implementation, the json module provides > one which works for most object types. If you swap library to something else > you might have to re-implement to for that library if it doesn't already > exist. I know, and thanks for that information. But like I s

Custom type conversion

2024-03-13 Thread scippie
That seems to work perfectly, thanks! Just to be sure, is this correct? converter toObject(node: JsonNode) : Object = result = Object( ... ) Run Is the name of the converter arbitrary? It seems to work with a completely different name too. If so, is there a reas

Custom type conversion

2024-03-13 Thread scippie
Please understand that I come from a C/C++ world (I do have experience with other languages), so I am still trying to find out how things are done. Well, the 'to' proc is, if I understand correctly, the same as my 'constructObjectfromJson' proc, only named differently. I will change the name to

Custom type conversion

2024-03-13 Thread scippie
I understand, but in this case we are talking about Json, but next time it may be something different or even custom. I didn't make that clear in my OP, but I may step away from json at some point.

Json: Error: type mismatch: got '...' but expected '(string, string)'

2024-03-09 Thread scippie
That was it! Thank you!

Json: Error: type mismatch: got '...' but expected '(string, string)'

2024-03-09 Thread scippie
I am very new to the Nim language. However, in only 2 hours time, I successfully converted an existing project of mine into Nim. Wow! However, now I want to be able to store/restore an object by using a json file. When I try the code at the nim-by-example json tutorial, it works perfectly. Howe