4 ms·
Can I create a shared library with it? Can it be used to write a ruby extension?
by stewbrew 10y ago
Can I create a shared library with it? Can it be used to write a ruby extension?
- spalladino2 10y agoSee https://gist.github.com/spalladino/10c829db3191a89a8ba73bb001d3c921 https://gist.github.com/spalladino/10c829db3191a89a8ba73bb00... We'll probably build it into a more stable shard eventually, but at least we know it's doable
- RX14 10y agoThe answer is technically yes but you probably don't want to. Crystal comes with a managed runtime and gc, which are particularly unsuited for use in a shared library. However you can export c functions (it's a hidden feature) and they do work. Creating a ruby extension in crystal also works and there are a number of libraries which attempt to allow you to do this (too many in fact). They do the hard work of getting crystal to play nice with the ruby extension api for you.