Haskell Foreign Library For The DISTRHO Plugin Framework

In this post I introduce a new MIDI plugin I wrote as a foreign-library:

9 Likes

Very cool, and this is the first time I’ve seen foreign-library! :exploding_head:

1 Like

Thanks Ollie! I couldn’t believe it worked so well:)

I forgot to mention that the generated stub header uses typedefs from HsFFI and I had to cast the pointers to fix g++ type error. So perhaps there is a safer way to expose the Haskell functions. For what it’s worth, the header looked like this:

#include <HsFFI.h>
#if defined(__cplusplus)
extern "C" {
#endif
extern HsStablePtr pluguzuNew(void);
extern void pluguzuParse(HsStablePtr a1, HsPtr a2);
extern HsPtr pluguzuError(HsStablePtr a1);
extern HsWord64 pluguzuRender(HsStablePtr a1, HsWord a2, HsWord a3, HsPtr a4);
#if defined(__cplusplus)
}
#endif