121121generate_obj_for_compile(f, tt, path::String = tempname(), name = fix_name(f), filenamebase::String="obj";
122122 \t mixtape = NoContext(),
123123 \t strip_llvm = false,
124- \t strip_asm = true,
124+ \t strip_asm = true,
125125 \t target = (),
126- \t opt_level= 3,
126+ \t opt_level = 3,
127127 \t kwargs...)
128128```
129129Low level interface for compiling object code (`.o`) for for function `f` given
@@ -155,7 +155,7 @@ shell> tree \$path
155155function generate_obj_for_compile (f, tt, external = true , path:: String = tempname (), name = fix_name (f), filenamebase:: String = " obj" ;
156156 mixtape = NoContext (),
157157 strip_llvm = false ,
158- strip_asm = true ,
158+ strip_asm = true ,
159159 opt_level = 3 ,
160160 remove_julia_addrspaces = false ,
161161 target = (),
@@ -271,9 +271,9 @@ function compile_executable(f::Function, types=(), path::String="./", name=fix_n
271271end
272272
273273function compile_executable (funcs:: Union{Array,Tuple} , path:: String = " ./" , name= fix_name (first (first (funcs)));
274- filename= name,
275- demangle= false ,
276- cflags= ` ` ,
274+ filename = name,
275+ demangle = true ,
276+ cflags = ` ` ,
277277 kwargs...
278278 )
279279
@@ -294,14 +294,11 @@ end
294294"""
295295```julia
296296compile_shlib(f::Function, types::Tuple, [path::String="./"], [name::String=repr(f)]; filename::String=name, cflags=``, kwargs...)
297- compile_shlib(funcs::Array, [path::String="./"]; filename="libfoo", demangle=false , cflags=``, kwargs...)
297+ compile_shlib(funcs::Array, [path::String="./"]; filename="libfoo", demangle=true , cflags=``, kwargs...)
298298```
299299As `compile_executable`, but compiling to a standalone `.dylib`/`.so` shared library.
300300
301- The compiled function is by default given the symbol name `julia_$(name) `, i.e.,
302- the function `test` in the example below is called `julia_test` in the shared library.
303- The keword argument `demangle=true` will remove this prefix, but is currently only
304- supported the second (multi-function-shlib) method.
301+ If `demangle` is set to `false`, compiled function names are prepended with "julia_".
305302
306303### Examples
307304```julia
@@ -322,7 +319,7 @@ julia> compile_shlib(test, (Int,))
322319julia> test(100_000)
3233205.2564961094956075
324321
325- julia> ccall(("julia_test ", "test.dylib"), Float64, (Int64,), 100_000)
322+ julia> ccall(("test ", "test.dylib"), Float64, (Int64,), 100_000)
3263235.2564961094956075
327324```
328325"""
@@ -334,9 +331,9 @@ function compile_shlib(f::Function, types=(), path::String="./", name=fix_name(f
334331end
335332# As above, but taking an array of functions and returning a single shlib
336333function compile_shlib (funcs:: Union{Array,Tuple} , path:: String = " ./" ;
337- filename= " libfoo" ,
338- demangle= false ,
339- cflags= ` ` ,
334+ filename = " libfoo" ,
335+ demangle = true ,
336+ cflags = ` ` ,
340337 kwargs...
341338 )
342339 for func in funcs
@@ -358,20 +355,17 @@ end
358355"""
359356```julia
360357compile_wasm(f::Function, types::Tuple, [path::String="./"], [name::String=repr(f)]; filename::String=name, flags=``, kwargs...)
361- compile_wasm(funcs::Union{Array,Tuple}, [path::String="./"]; filename="libfoo", demangle=false , flags=``, kwargs...)
358+ compile_wasm(funcs::Union{Array,Tuple}, [path::String="./"]; filename="libfoo", demangle=true , flags=``, kwargs...)
362359```
363360As `compile_shlib`, but compiling to a WebAssembly library.
364361
365- The compiled function is by default given the symbol name `julia_$(name) `, i.e.,
366- the function `test` in the example below is called `julia_test` in the shared library.
367- The keword argument `demangle=true` will remove this prefix, but is currently only
368- supported the second (multi-function-shlib) method.
362+ If `demangle` is set to `false`, compiled function names are prepended with "julia_".
369363```
370364"""
371365function compile_wasm (f:: Function , types= ();
372- path:: String = " ./" ,
373- filename= fix_name (f),
374- flags= ` ` ,
366+ path:: String = " ./" ,
367+ filename = fix_name (f),
368+ flags = ` ` ,
375369 kwargs...
376370 )
377371 tt = Base. to_tuple_type (types)
@@ -471,8 +465,8 @@ Hello, world!
471465"""
472466generate_executable (f, tt, args... ; kwargs... ) = generate_executable (((f, tt),), args... ; kwargs... )
473467function generate_executable (funcs:: Union{Array,Tuple} , path= tempname (), name= fix_name (first (first (funcs))), filename= name;
474- demangle= false ,
475- cflags= ` ` ,
468+ demangle = true ,
469+ cflags = ` ` ,
476470 kwargs...
477471 )
478472 lib_path = joinpath (path, " $filename .$(Libdl. dlext) " )
@@ -511,12 +505,14 @@ end
511505"""
512506```julia
513507generate_shlib(f::Function, tt, [external::Bool=true], [path::String], [name], [filename]; kwargs...)
514- generate_shlib(funcs::Array, [external::Bool=true], [path::String], [filename::String]; demangle=false , kwargs...)
508+ generate_shlib(funcs::Array, [external::Bool=true], [path::String], [filename::String]; demangle=true , kwargs...)
515509```
516510Low level interface for compiling a shared object / dynamically loaded library
517511 (`.so` / `.dylib`) for function `f` given a tuple type `tt` characterizing
518512the types of the arguments for which the function will be compiled.
519513
514+ If `demangle` is set to `false`, compiled function names are prepended with "julia_".
515+
520516### Examples
521517```julia
522518julia> using StaticCompiler, LoopVectorization
@@ -542,7 +538,7 @@ shell> tree \$path
542538julia> test(100_000)
5435395.2564961094956075
544540
545- julia> ccall(("julia_test ", "example/test.dylib"), Float64, (Int64,), 100_000)
541+ julia> ccall(("test ", "example/test.dylib"), Float64, (Int64,), 100_000)
5465425.2564961094956075
547543```
548544"""
@@ -551,8 +547,8 @@ function generate_shlib(f::Function, tt, external::Bool=true, path::String=tempn
551547end
552548# As above, but taking an array of functions and returning a single shlib
553549function generate_shlib (funcs:: Union{Array,Tuple} , external:: Bool = true , path:: String = tempname (), filename:: String = " libfoo" ;
554- demangle= false ,
555- cflags= ` ` ,
550+ demangle = true ,
551+ cflags = ` ` ,
556552 kwargs...
557553 )
558554
@@ -595,7 +591,7 @@ function native_llvm_module(f, tt, name=fix_name(f); demangle, kwargs...)
595591end
596592
597593# Return an LLVM module for multiple functions
598- function native_llvm_module (funcs:: Union{Array,Tuple} ; demangle= false , kwargs... )
594+ function native_llvm_module (funcs:: Union{Array,Tuple} ; demangle= true , kwargs... )
599595 f,tt = funcs[1 ]
600596 mod = native_llvm_module (f,tt; demangle, kwargs... )
601597 if length (funcs) > 1
@@ -635,10 +631,10 @@ end
635631generate_obj(f, tt, external::Bool, path::String = tempname(), filenamebase::String="obj";
636632 mixtape = NoContext(),
637633 target = (),
638- demangle =false ,
634+ demangle = true ,
639635 strip_llvm = false,
640636 strip_asm = true,
641- opt_level= 3,
637+ opt_level = 3,
642638 kwargs...)
643639```
644640Low level interface for compiling object code (`.o`) for for function `f` given
@@ -652,6 +648,8 @@ function will be compiled.
652648This is a named tuple with fields `triple`, `cpu`, and `features` (each of these are strings).
653649The defaults compile to the native target.
654650
651+ If `demangle` is set to `false`, compiled function names are prepended with "julia_".
652+
655653### Examples
656654```julia
657655julia> fib(n) = n <= 1 ? n : fib(n - 1) + fib(n - 2)
@@ -695,7 +693,7 @@ This is a named tuple with fields `triple`, `cpu`, and `features` (each of these
695693The defaults compile to the native target.
696694"""
697695function generate_obj (funcs:: Union{Array,Tuple} , external:: Bool , path:: String = tempname (), filenamebase:: String = " obj" ;
698- demangle = false ,
696+ demangle = true ,
699697 strip_llvm = false ,
700698 strip_asm = true ,
701699 opt_level = 3 ,
0 commit comments