I never tried to bind Fortran libraries to Nim, but I often have to deal with
Fortran codes in my job. If you are lucky enough to work with Fortran 2003 or
2008, you can use `iso_c_binding`:
The only time I have seen Fortran code is when dealing with nasa orbital
simulation stuff. I think Fortran is pretty rare and experience with it is rare
too. If it can export c calling convention and be compiled into a dynamic link
library then anything is possible?
"moon rise and set time" oh I have another library for you:
[https://github.com/treeform/orbits](https://github.com/treeform/orbits)
You can see adapt JPL Horizon api to get the exact "moon rise and set time"
times directly from Nasa.
You right about chrono and miniz. Miniz is just there to
I had this question myself just yesterday and didn't notice `countup` in a
browse through the `system` page. Looks like the "Nim for python programmers"
page linked didn't mention it, so I went ahead and added a section about it!
Reverse engineering even a normal compiled binary is a lot of work, but it can
be studied in memory. It's easy to obfuscate all identifier names and add
computational noise (there are C/C++ products that do this), which will make
reverse engineering harder but still doable.
The only way to
Well your list lacks:
[https://www.lazarus-ide.org](https://www.lazarus-ide.org)/
> Cost of implementing such std GUI / drawing / clipboard is not smaller than
> third-party one, isn't it? If there is a such third-party library supports
> major platforms, nice license, open source, why is std one needed?
**If** there is - sure. Right now it's probably QT wrappers, which was
If "nice" means this 4 functions:
# SDL_clipboard.h
proc setClipboardText*(text: cstring): cint {.importc:
"SDL_SetClipboardText".}
proc getClipboardText*(): cstring {.importc: "SDL_GetClipboardText".}
proc hasClipboardText*(): Bool32 {.importc: "SDL_HasClipboardText".}
Just out of curiosity. Is binding with Fortran not considered or not feasible
or just too much effort?
If you know how to improve it, then send the improvements. If its not perfect
does not meant is useless. IMHO.
This happens because the proc fields of `times.Timezone` isn't marked with
`noSideEffect`. The same thing happens if you try to do anything with streams
inside a `func`, since streams also use proc fields without `noSideEffect`.
This could be changed, but imo Nims effect system isn't worth
Thanks for the quick responses. When I try to use chrono, it complains that
miniz is missing, so it that truely pure nim? Could it work without miniz.
Unfortunately, I cannot use an approximate solution without timezones since the
code will be used to calculate the moon rise and set time for a
> I think it would be good to have a more fleshed out "Nim for {programming
> language} programmers". There are some of them on the github page
>
> I would happily contribute to something line that
*
> So you haven't yet read our page with the most learning resources? ;)
> [https://nim-lang.org/learn.html](https://nim-lang.org/learn.html)
Apparently not 臘♀️ can't remember when I looked there last time tbh. Are some
really neat resources there!
> These are in our wiki and everybody can
I think it would be good to have a more fleshed out "Nim for {programming
language} programmers". There are some of them on the github page but I haven't
found any links to them except from Google. I would happily contribute to
something line that
Thanks. I just came back to red-facedly say I'd sussed it out. But you beat me
to it.
I shall award myself the "RTFM Badge of Shame" immediately
[although, in my defence, I searched the docs for "range" and "step". Didn't
think of "countup"]
Awesome to hear :-) I'm also new to this so we are in the same boat ;-) What we
don't know, we can learn. And in our case, will learn
Let me know if you gets it yo work, or more importantly if it doesn't. You
learn more from a failure than a success I have just been pounding at some
with this PR
[https://github.com/nim-lang/Nim/pull/11754](https://github.com/nim-lang/Nim/pull/11754)
we can do it as follows:
dispatch foo:
for a in 0..<3:
echo a
echo 10
Run
I'd love to collaborate. But I am still pretty useless.
I am trying to use it on Linux.
Just in case somebody doesn't know already: SDL2 has some nice, simple
clipboard support.
Is there a way for nim to tell me when:
* I can remove an import (unused imports)
* I can convert a proc to a func (for procs that don't have site effects)
* I can convert a var to a let (for variables that are only assigned once)
* I can convert a let or var to a const (for variables in
To circumvent the effect system, you can use this (since 0.20.0):
func test(unixTime: int64): bool =
{.noSideEffect.}:
let t1 = local(fromUnix(unixTime))
Run
I think it leads to side effects because it uses clib's time functions. I have
a pure nim implementation of times, calendars and timezones here:
[https://github.com/treeform/chrono](https://github.com/treeform/chrono)
import chrono
proc test1(unixTime: int64): bool =
I didn't want to introduce more complexity by using XML (which is a pile of
crap and always was) or JSON (which will hopefully go the same way as XML
because its just as bad) just to put some strings into an array. Simple things
like that should be built into the language.
There are platform without GUI or clipboard. (e.g. embed system, Linux without
Xorg) Making std GUI / drawing / clipboard library means that the language
doesn't support such platforms? When I want to compile these language that has
std GUI / drawing / clipboard library, I also have to build
There is
[countup](https://nim-lang.github.io/Nim/system.html#countup.i%2CT%2CT%2CPositive),
which can be used as:
var text = "Hello there How are you This is a string Blah Blah Blah"
for i in countup(0, len(text)-3, 2):
echo text[i],text[i+1],text[i+2]
Run
Hi, I'd like to write a function that extracts the date from a DateTime object
returns a new DateTime object with that date but time set to 00:00:00. The
input will be in unixtime due to other requirements. When I use the following
func test(unixTime: int64): bool =
let t1 =
> Is having a "std" GUI / drawing / clipboard / etc lib really so important
> when there are non-"std" candidates in nimble?
Yes, quite a lot. **Std** GUI lib means that you can and will be able to make
ui using same code for every compatible platform _and_ 90% extensions (like
custom
Probably one to file under "Newbie Questions", but here goes...
I'm trying to iterate over a string and get the characters in it 3 at a time.
In Python, I can use the fact that range has a step attribute to do something
like:
text = "Hello there How are you This is a string Blah
Tbh, "Data" command was never meant for anything useful except backward
compatibility - just like, say, "GoSub". You can always just use
'IncludeBinary' and std JSON/XML parsers.
I reckon it depends on what you are trying to hide? The source code itself or
some routine that's running at the same time as your binary?
The only way to fully guarantee some source code protection is to obfuscate it
before you compile.
I have started to wrap the Sundials project and my first goal was to wrap the
N_Vector shared library, which I to some extent has succeeded with but in a
rather hacky, and not so seamless, way. The structure of the files can be found
in my github repo:
Is there anyway to harden the compiled binaries against code hackers?
I just did:
[https://github.com/nim-lang/Nim/issues/11747](https://github.com/nim-lang/Nim/issues/11747)
Sufficient?
echo sizeof(MyRefObject[])
Run
should just work, bug report please.
35 matches
Mail list logo