Skip to content

Commit

Permalink
Merge pull request #53 from SciNim/fix-julia-1.11.api.change
Browse files Browse the repository at this point in the history
Fix Julia 1.11 jl_array_data -> jl_array-data_; TODO investigate new API
  • Loading branch information
Clonkk authored Oct 21, 2024
2 parents fc0a04c + 442ed51 commit 17906d6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ jobs:
- devel
os:
- ubuntu-latest
- macOS-latest
# - macOS-latest
julia:
- '1.10'
- '1.11'
- 'lts'

steps:
- uses: actions/checkout@v4
Expand All @@ -34,6 +38,8 @@ jobs:
uses: julia-actions/setup-julia@latest
with:
show-versioninfo: 'true'
arch: ${{ runner.arch }}
version: ${{ matrix.julia }}

- run: nimble install -y
env:
Expand Down
10 changes: 5 additions & 5 deletions nimjl/config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ when exitCode != 0:

const JuliaArrayVersion* = cmdOutput.split("\"")[1].split(".")

# For release : result has the form ["v", "1.6.0", ""] -> splitting [1] yiels ["1", "6, "0"]
# For dev: result has the form ["v", "1.7.0-DEV", "667"] -> splitting [1] yiels ["1", "7, "0-DEV", "667"]
const JuliaMajorVersion* = JuliaArrayVersion[0].parseInt
const JuliaMinorVersion* = JuliaArrayVersion[1].parseInt
const JuliaPatchVersion* = JuliaArrayVersion[2].parseInt
# For release : result has the form ["v", "1.6.0", ""] -> splitting [1] yields ["1", "6, "0"]
# For dev: result has the form ["v", "1.7.0-DEV", "667"] -> splitting [1] yields ["1", "7, "0-DEV", "667"]
const JuliaMajorVersion* = JuliaArrayVersion[0].parseInt()
const JuliaMinorVersion* = JuliaArrayVersion[1].parseInt()
const JuliaPatchVersion* = JuliaArrayVersion[2].parseInt()
const libPrefix = "lib"
const libSuffix = ".so"
const JuliaLibName* = JuliaLibPath / libPrefix & "julia" & libSuffix
Expand Down
7 changes: 6 additions & 1 deletion nimjl/private/jlarrays.nim
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ template julia_type(arg: typedesc): ptr jl_datatype =

## Array bindings
{.push nodecl, header: JuliaHeader, dynlib: JuliaLibName.}
proc jl_array_data*(values: ptr jl_array): pointer {.importc.}

when (JuliaMajorVersion, JuliaMinorVersion) >= (1, 11):
proc jl_array_data*(values: ptr jl_array): pointer {.importc: "jl_array_data_".}
else:
proc jl_array_data*(values: ptr jl_array): pointer {.importc: "jl_array_data".}

proc jl_array_dim*(a: ptr jl_array, dim: cint): cint {.importc.}
proc jl_array_len*(a: ptr jl_array): cint {.importc.}
proc jl_array_rank*(a: ptr jl_value): cint {.importc.}
Expand Down

0 comments on commit 17906d6

Please sign in to comment.