Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running external programs #165

Closed
Thomas008 opened this issue Aug 7, 2024 · 3 comments
Closed

Running external programs #165

Thomas008 opened this issue Aug 7, 2024 · 3 comments

Comments

@Thomas008
Copy link
Contributor

Is it possible to call external programs in a code that can be staticcally compiled with StaticCompiler (e.g. a shell script test.sh)?

@brenhinkeller
Copy link
Collaborator

brenhinkeller commented Aug 7, 2024 via email

@brenhinkeller
Copy link
Collaborator

brenhinkeller commented Aug 7, 2024

Or if ccall/@ccall don't wont to compile then I suppose StaticTools.@symbolcall should definitely work, e.g.

julia> using StaticTools

julia> function sys(s)
           @symbolcall system(pointer(s)::Ptr{UInt8})::Int
       end
sys (generic function with 1 method)

julia> sys(c"pwd")
/Users/me
0

(though could get even more cursed / cause UB if done wrong, since that has no safety features)

@Thomas008
Copy link
Contributor Author

Thank you! This works perfect!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants