SqueakNim - an FFI glue code tool

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

SqueakNim - an FFI glue code tool

Göran Krampe
(resend)
Hi fellow Smalltalkers!

At 3DICC we are using Nim (http://nim-lang.org) to write our performance
critical code that typically otherwise would have been written in C/C++.
But now we have Nim :)

Nim can generate dlls/so libraries following C conventions so they can
easily be called via FFI.

Andreas Rumpf (author of Nim who works with us) wrote a small utility
called SqueakNim - its a set of Nim macros that generates the .st
primitive calls based on the Nim code, so it takes out some grunt work
and matches up types as far as it can. Simple, but very nice.

The docs etc are a bit unpolished, but the trivial example in "tests"
has comments in it and it works in Squeak 5, Pharo 3, Pharo 4 and I
guess in most versions of Squeak/Pharo.

Why would you be interested?

- Nim is great fun! C/C++ is torture. Same performance, nuff said.
- Nim has a tool called c2nim that wraps C *and* C++ libraries.

That last part is a killer. We use c2nim to wrap Urho3D - a huge C++
game engine, works great, and that wrapper is also open source btw,
Urhonimo.

How do I use it? See README at:

https://gitlab.3dicc.com/3dicc/squeaknim

For some more information my article (predating this tool) might have
some details:

http://goran.krampe.se/2014/11/03/squeak-to-nim

...and if you want to ask questions, hop onto freenode on either
#squeak, #pharo or #nim. Me and Andreas are around.

regards, Göran


Reply | Threaded
Open this post in threaded view
|

Re: SqueakNim - an FFI glue code tool

Ben Coman
Sounds interesting. Thanks for the notice.
cheers -ben

On Tue, Aug 18, 2015 at 7:55 PM, Göran Krampe <[hidden email]> wrote:

> (resend)
> Hi fellow Smalltalkers!
>
> At 3DICC we are using Nim (http://nim-lang.org) to write our performance
> critical code that typically otherwise would have been written in C/C++. But
> now we have Nim :)
>
> Nim can generate dlls/so libraries following C conventions so they can
> easily be called via FFI.
>
> Andreas Rumpf (author of Nim who works with us) wrote a small utility called
> SqueakNim - its a set of Nim macros that generates the .st primitive calls
> based on the Nim code, so it takes out some grunt work and matches up types
> as far as it can. Simple, but very nice.
>
> The docs etc are a bit unpolished, but the trivial example in "tests" has
> comments in it and it works in Squeak 5, Pharo 3, Pharo 4 and I guess in
> most versions of Squeak/Pharo.
>
> Why would you be interested?
>
> - Nim is great fun! C/C++ is torture. Same performance, nuff said.
> - Nim has a tool called c2nim that wraps C *and* C++ libraries.
>
> That last part is a killer. We use c2nim to wrap Urho3D - a huge C++ game
> engine, works great, and that wrapper is also open source btw, Urhonimo.
>
> How do I use it? See README at:
>
> https://gitlab.3dicc.com/3dicc/squeaknim
>
> For some more information my article (predating this tool) might have some
> details:
>
> http://goran.krampe.se/2014/11/03/squeak-to-nim
>
> ...and if you want to ask questions, hop onto freenode on either #squeak,
> #pharo or #nim. Me and Andreas are around.
>
> regards, Göran
>
>