This repository has been archived by the owner. It is now read-only.

hello-world-crystal-nostd-sharedlib

Baby experiment to build a shared library with crystal code

'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
  1. Build the tester run_shared (written in C)

    $ make run_shared
    
  2. Build the shared library hello_llvm.so (written in Crystal, without stdlib)

    $ make hello_llvm.so
    
  3. Finally, run the binary run_shared, this will open the hello_llvm.so shared library, locate a function named crystal_do_something, then run it.

    $ ./run_shared
    $ echo $?
    42
    
Repository

hello-world-crystal-nostd-sharedlib

Owner
Statistic
  • 2
  • 0
  • 0
  • 0
  • 0
  • about 3 years ago
  • May 28, 2017
License

Links
Synced at

Sun, 05 May 2024 01:31:09 GMT

Languages