Skip to content
This repository has been archived by the owner on Feb 25, 2022. It is now read-only.

bew/hello-world-crystal-nostd-sharedlib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

'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

About

Baby experiment to build a shared library with crystal code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published