-
Notifications
You must be signed in to change notification settings - Fork 1
/
nimjl.nim
40 lines (28 loc) · 869 Bytes
/
nimjl.nim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import ./nimjl/arrays
export arrays
import ./nimjl/cores
export cores
import ./nimjl/types
export types
import ./nimjl/gc
export gc
import ./nimjl/functions
export functions
import ./nimjl/glucose
export glucose
import ./nimjl/conversions
export conversions
import ./nimjl/config
static:
debugEcho "Nimjl> Using : ", JuliaPath, "/bin/julia v", JuliaMajorVersion, ".", JuliaMinorVersion, ".", JuliaPatchVersion
import std/exitprocs
proc jlVmProcessExit() =
jlVmExit(0.cint)
addExitProc jlVmProcessExit
runnableExamples:
import nimjl
Julia.init() # Initialize Julia VM. Subsequent call to init will be ignored
var myval = 4.0'f64
discard Julia.println("Hello world") # No need for \n with Julia println function
var res = Julia.sqrt(myval).to(float64) # Call Julia function "sqrt" and convert the result to a float
echo res # sqrt(4.0) == 2.0