'Hello world' crystal shared library experiment
This is a baby experiment on LLVM compilation, to build a shared library from crystal source code
Simple Crystal code, with an empty prelude
Description
The generated library will exit the current process with error code 42
.
Run the test
$ cd ./simple_no_prelude
-
Build the tester
run_shared
(written in C)$ make run_shared
-
Build the shared library
hello_llvm.so
(written in Crystal, without stdlib)$ make hello_llvm.so
-
Finally, run the binary
run_shared
, this will open thehello_llvm.so
shared library, locate a function namedcrystal_do_something
, then run it.$ ./run_shared $ echo $? 42