SqueakNim - an FFI glue code tool

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

SqueakNim - an FFI glue code tool

Göran Krampe
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

Tobias Pape
Hi Göran

On 18.08.2015, at 10:35, Göran Krampe <[hidden email]> wrote:

> 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.

Thanks for that tool.
I'll sure have a look at it!

Best regards
        -Tobias


Reply | Threaded
Open this post in threaded view
|

RE: SqueakNim - an FFI glue code tool

Ron Teitelbaum
In reply to this post by Göran Krampe
Hi All,

Quick question.  I would normally take a message like this and announce it on news.squeak.org and other places.  Since this release comes from 3D ICC I wanted to see first if anyone sees a conflict between my role as news team guy and my real job.  Would anyone object to my adding this announcement to news.squeak.org?  

Thanks!

All the best,

Ron Teitelbaum
Head Of Engineering
3D Immersive Collaboration Consulting
[hidden email]
Follow Me On Twitter: @RonTeitelbaum
www.3Dicc.com
https://www.google.com/+3Dicc



> -----Original Message-----
> From: [hidden email] [mailto:squeak-dev-
> [hidden email]] On Behalf Of Göran Krampe
> Sent: Tuesday, August 18, 2015 4:36 AM
> To: The general-purpose Squeak developers list; Pharo Development
> Subject: [squeak-dev] SqueakNim - an FFI glue code tool
>
> 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

David T. Lewis
+1 to adding it to the Squeak news.

(and thank you for asking)

Dave

> Hi All,
>
> Quick question.  I would normally take a message like this and announce it
> on news.squeak.org and other places.  Since this release comes from 3D ICC
> I wanted to see first if anyone sees a conflict between my role as news
> team guy and my real job.  Would anyone object to my adding this
> announcement to news.squeak.org?
>
> Thanks!
>
> All the best,
>
> Ron Teitelbaum
> Head Of Engineering
> 3D Immersive Collaboration Consulting
> [hidden email]
> Follow Me On Twitter: @RonTeitelbaum
> www.3Dicc.com
> https://www.google.com/+3Dicc
>
>
>
>> -----Original Message-----
>> From: [hidden email] [mailto:squeak-dev-
>> [hidden email]] On Behalf Of Göran Krampe
>> Sent: Tuesday, August 18, 2015 4:36 AM
>> To: The general-purpose Squeak developers list; Pharo Development
>> Subject: [squeak-dev] SqueakNim - an FFI glue code tool
>>
>> 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

timrowledge
In reply to this post by Ron Teitelbaum

On 18-08-2015, at 8:23 AM, Ron Teitelbaum <[hidden email]> wrote:

> Hi All,
>
> Quick question.  I would normally take a message like this and announce it on news.squeak.org and other places.  Since this release comes from 3D ICC I wanted to see first if anyone sees a conflict between my role as news team guy and my real job.  Would anyone object to my adding this announcement to news.squeak.org?  

Good grief no; this is exactly the kind of thing I hope to see out there!


tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Strange OpCodes: OI: Vey



Reply | Threaded
Open this post in threaded view
|

Re: SqueakNim - an FFI glue code tool

Chris Muller-3
In reply to this post by Ron Teitelbaum
What about Magma 1.5?  I think it is very relevant to Squeak.  News it too?

On Tue, Aug 18, 2015 at 10:23 AM, Ron Teitelbaum <[hidden email]> wrote:

> Hi All,
>
> Quick question.  I would normally take a message like this and announce it on news.squeak.org and other places.  Since this release comes from 3D ICC I wanted to see first if anyone sees a conflict between my role as news team guy and my real job.  Would anyone object to my adding this announcement to news.squeak.org?
>
> Thanks!
>
> All the best,
>
> Ron Teitelbaum
> Head Of Engineering
> 3D Immersive Collaboration Consulting
> [hidden email]
> Follow Me On Twitter: @RonTeitelbaum
> www.3Dicc.com
> https://www.google.com/+3Dicc
>
>
>
>> -----Original Message-----
>> From: [hidden email] [mailto:squeak-dev-
>> [hidden email]] On Behalf Of Göran Krampe
>> Sent: Tuesday, August 18, 2015 4:36 AM
>> To: The general-purpose Squeak developers list; Pharo Development
>> Subject: [squeak-dev] SqueakNim - an FFI glue code tool
>>
>> 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

David T. Lewis
+1 !!!!

Dave

> What about Magma 1.5?  I think it is very relevant to Squeak.  News it
> too?
>
> On Tue, Aug 18, 2015 at 10:23 AM, Ron Teitelbaum <[hidden email]> wrote:
>> Hi All,
>>
>> Quick question.  I would normally take a message like this and announce
>> it on news.squeak.org and other places.  Since this release comes from
>> 3D ICC I wanted to see first if anyone sees a conflict between my role
>> as news team guy and my real job.  Would anyone object to my adding this
>> announcement to news.squeak.org?
>>
>> Thanks!
>>
>> All the best,
>>
>> Ron Teitelbaum
>> Head Of Engineering
>> 3D Immersive Collaboration Consulting
>> [hidden email]
>> Follow Me On Twitter: @RonTeitelbaum
>> www.3Dicc.com
>> https://www.google.com/+3Dicc
>>
>>
>>
>>> -----Original Message-----
>>> From: [hidden email] [mailto:squeak-dev-
>>> [hidden email]] On Behalf Of Göran Krampe
>>> Sent: Tuesday, August 18, 2015 4:36 AM
>>> To: The general-purpose Squeak developers list; Pharo Development
>>> Subject: [squeak-dev] SqueakNim - an FFI glue code tool
>>>
>>> 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

Göran Krampe
In reply to this post by Chris Muller-3
Hi all!

On 08/18/2015 06:53 PM, Chris Muller wrote:
> What about Magma 1.5?  I think it is very relevant to Squeak.  News it too?

For sure! Its generally better if you bug Ron with items for him to put
up because he is working like a dog right now so hardly any "periscope
up" time at all.

regards, Göran

Reply | Threaded
Open this post in threaded view
|

RE: SqueakNim - an FFI glue code tool

Ron Teitelbaum
In reply to this post by Chris Muller-3
Hi Chris,

Sorry I missed it!  Here ya go!

http://news.squeak.org/2015/08/18/magma-1-5-for-squeak-5-ships/ 

If anyone else has suggestions for posts, please feel free to ping me.

Last ping I got was from Bert.  Also if anyone would like to volunteer for the news team and write articles we can always use help!

All the best,

Ron Teitelbaum
Head Of Engineering
3D Immersive Collaboration Consulting
[hidden email]
Follow Me On Twitter: @RonTeitelbaum
www.3Dicc.com
https://www.google.com/+3Dicc


 

> -----Original Message-----
> From: [hidden email] [mailto:squeak-dev-
> [hidden email]] On Behalf Of Chris Muller
> Sent: Tuesday, August 18, 2015 12:54 PM
> To: The general-purpose Squeak developers list
> Cc: Pharo Development
> Subject: Re: [squeak-dev] SqueakNim - an FFI glue code tool
>
> What about Magma 1.5?  I think it is very relevant to Squeak.  News it too?
>
> On Tue, Aug 18, 2015 at 10:23 AM, Ron Teitelbaum <[hidden email]>
> wrote:
> > Hi All,
> >
> > Quick question.  I would normally take a message like this and announce it
> on news.squeak.org and other places.  Since this release comes from 3D ICC I
> wanted to see first if anyone sees a conflict between my role as news team
> guy and my real job.  Would anyone object to my adding this announcement
> to news.squeak.org?
> >
> > Thanks!
> >
> > All the best,
> >
> > Ron Teitelbaum
> > Head Of Engineering
> > 3D Immersive Collaboration Consulting
> > [hidden email]
> > Follow Me On Twitter: @RonTeitelbaum
> > www.3Dicc.com
> > https://www.google.com/+3Dicc
> >
> >
> >
> >> -----Original Message-----
> >> From: [hidden email]
> >> [mailto:squeak-dev- [hidden email]] On Behalf Of
> >> Göran Krampe
> >> Sent: Tuesday, August 18, 2015 4:36 AM
> >> To: The general-purpose Squeak developers list; Pharo Development
> >> Subject: [squeak-dev] SqueakNim - an FFI glue code tool
> >>
> >> 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

Chris Muller-4
Thanks Ron!

On Tue, Aug 18, 2015 at 12:35 PM, Ron Teitelbaum <[hidden email]> wrote:

> Hi Chris,
>
> Sorry I missed it!  Here ya go!
>
> http://news.squeak.org/2015/08/18/magma-1-5-for-squeak-5-ships/
>
> If anyone else has suggestions for posts, please feel free to ping me.
>
> Last ping I got was from Bert.  Also if anyone would like to volunteer for the news team and write articles we can always use help!
>
> All the best,
>
> Ron Teitelbaum
> Head Of Engineering
> 3D Immersive Collaboration Consulting
> [hidden email]
> Follow Me On Twitter: @RonTeitelbaum
> www.3Dicc.com
> https://www.google.com/+3Dicc
>
>
>
>
>> -----Original Message-----
>> From: [hidden email] [mailto:squeak-dev-
>> [hidden email]] On Behalf Of Chris Muller
>> Sent: Tuesday, August 18, 2015 12:54 PM
>> To: The general-purpose Squeak developers list
>> Cc: Pharo Development
>> Subject: Re: [squeak-dev] SqueakNim - an FFI glue code tool
>>
>> What about Magma 1.5?  I think it is very relevant to Squeak.  News it too?
>>
>> On Tue, Aug 18, 2015 at 10:23 AM, Ron Teitelbaum <[hidden email]>
>> wrote:
>> > Hi All,
>> >
>> > Quick question.  I would normally take a message like this and announce it
>> on news.squeak.org and other places.  Since this release comes from 3D ICC I
>> wanted to see first if anyone sees a conflict between my role as news team
>> guy and my real job.  Would anyone object to my adding this announcement
>> to news.squeak.org?
>> >
>> > Thanks!
>> >
>> > All the best,
>> >
>> > Ron Teitelbaum
>> > Head Of Engineering
>> > 3D Immersive Collaboration Consulting
>> > [hidden email]
>> > Follow Me On Twitter: @RonTeitelbaum
>> > www.3Dicc.com
>> > https://www.google.com/+3Dicc
>> >
>> >
>> >
>> >> -----Original Message-----
>> >> From: [hidden email]
>> >> [mailto:squeak-dev- [hidden email]] On Behalf Of
>> >> Göran Krampe
>> >> Sent: Tuesday, August 18, 2015 4:36 AM
>> >> To: The general-purpose Squeak developers list; Pharo Development
>> >> Subject: [squeak-dev] SqueakNim - an FFI glue code tool
>> >>
>> >> 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
>> >
>> >
>> >
>
>