golang-embed-julia

command module
v0.0.0-...-6297017 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2021 License: MIT Imports: 1 Imported by: 0

README

golang-embed-julia

Official documentation: https://docs.julialang.org/en/v1/manual/embedding

Determine the required compiler flags

You can get the required flags for your system using the julia-config.jl script. It is included with the julia installation, but the location depends on your Julia installation environment. First, check the output of

echo $JULIA_DEPOT_PATH

If that environment variable is set, the script might be in one of the indicated directories. If it is unset, or you can't find it there, try

julia -e "println(DEPOT_PATH)"

Use the cgo directive to load the Julia C libraries

Documentation: https://golang.org/cmd/cgo/

Your go header will have the following structure:

package main

// #cgo CFLAGS: <output of julia-config.jl --cflags>
// #cgo LDFLAGS: <output of julia-config.jl --allflags starting from after the CFLAGS part>
// #include <julia.h>
import "C"

Test the provided go file:

$ go run embed.go
1.4142135623730951
$

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL