-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
81fd27a
commit 0ee1437
Showing
3 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Hello World with C | ||
|
||
- Install Julia in advance | ||
- Just run the following command: | ||
|
||
```sh | ||
$ bash run.sh | ||
1.4142135623730951 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <julia.h> | ||
JULIA_DEFINE_FAST_TLS // only define this once, in an executable (not in a shared library) if you want fast code. | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
/* required: setup the Julia context */ | ||
jl_init(); | ||
|
||
/* run Julia commands */ | ||
jl_eval_string("print(sqrt(2.0))"); | ||
|
||
/* strongly recommended: notify Julia that the | ||
program is about to terminate. this allows | ||
Julia time to cleanup pending write requests | ||
and run all finalizers | ||
*/ | ||
jl_atexit_hook(0); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
JULIA_DIR=`julia -e 'print(dirname(Sys.BINDIR))'` | ||
gcc -fPIC -I$JULIA_DIR/include/julia -L$JULIA_DIR/lib -Wl,-rpath,$JULIA_DIR/lib main.c -ljulia | ||
./a.out |