File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 76
76
# although it's hardly a big deal.
77
77
@include_model " Base Julia features" " control_flow"
78
78
@include_model " Base Julia features" " multithreaded"
79
+ @include_model " Base Julia features" " call_C"
79
80
@include_model " Core Turing syntax" " broadcast_macro"
80
81
@include_model " Core Turing syntax" " dot_assume"
81
82
@include_model " Core Turing syntax" " dot_observe"
Original file line number Diff line number Diff line change
1
+ # Get name of C standard library depending on the platform
2
+ libc_name = Sys. iswindows () ? " msvcrt.dll" :
3
+ Sys. isapple () ? " libc.dylib" :
4
+ " libc.so.6"
5
+
6
+ @model function call_C (y)
7
+ x ~ Normal (0 , 1 )
8
+
9
+ # Call C library abs function
10
+ x_abs = @ccall libc_name. fabs (x:: Cdouble ):: Cdouble
11
+
12
+ y ~ Normal (0 , x_abs)
13
+ end
14
+
15
+ model = call_C ()
You can’t perform that action at this time.
0 commit comments