Hi Experts,
How can I connect to libraries of the type that I would "include" in a C program? Must I re-compile Pharo to include them or is there some other way to do this at run-time? I'm looking at some Gnome libraries (GTK+, Gstreamer) which I would like to use from Pharo. Thanks, Bill _______________________________________________ Pharo-users mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users |
Hi bill
you can use FFI, we should write a chapter. I think that there are some material on the web you can define your own plugin. Have a look for the second on the chapter of the book http://stephane.ducasse.free.fr/FreeBooks/CollectiveNBlueBook/ On Apr 21, 2010, at 6:41 PM, Bill Rodgers wrote: > Hi Experts, > > How can I connect to libraries of the type that I would "include" in a C program? Must I re-compile Pharo to include them or is there some other way to do this at run-time? > > I'm looking at some Gnome libraries (GTK+, Gstreamer) which I would like to use from Pharo. John macintosh did a Gstreamer plugin for squeak/sophie/ > > Thanks, > > Bill > _______________________________________________ > Pharo-users mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users _______________________________________________ Pharo-users mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users |
Very cool !
Thanks, Bill On Wed, Apr 21, 2010 at 1:58 PM, Stéphane Ducasse <[hidden email]> wrote: Hi bill _______________________________________________ Pharo-users mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users |
Hi Bill. You have 2 possibilities:
1) Use FFI. With this you can call C functions from shared libraries. No need to recompile de VM. Main problem: it locks the whole VM while the function is being run. The FFI is included in most VMs so it is easy. What you DO need to install is the smalltalk side of FFI. A simple way in Pharo is evaluating: Gofer new squeaksource: 'MetacelloRepository'; package: 'ConfigurationOfFFI'; load. ((Smalltalk at: #ConfigurationOfFFI) project version: '1.2') load. There are a lot of examples and libraries wrapped with FFI. We developed a wrapper for the OpenDBX library....the project is call SqueakDBX (www.squeakdbx.org) and would be useful if you want a real example using FFI. FFI: http://wiki.squeak.org/squeak/1414 2) Write your own named plugin. This is, you write your plugin in SLANG (a limited Smalltallk that it is used to write part of the vm and then translated to C) and then, using VMMaker you generate C code, and after, you can generate the binaries. Finally when you distribute your app you will need to add such plugin to the VM. http://wiki.squeak.org/squeak/356 http://wiki.squeak.org/squeak/464 Particulary for GTK, look at the project (I think it is dead now) SqueakGTK: http://squeakgtk.pbworks.com/ Particuolary for Gstreamer I paste an email from John Macinstosh some time ago: "Well I'm not sure what you are asking for. The Gstreamer stuff starts at: MCHttpRepository location: 'http://www.squeaksource.com/GStreamer' user: '' password: '' You need a plugin and the GStreamer underpinnings install in your operating system. If you have have a linux box that is easy. If you have a mac, you could use MacPorts to install GStreamer and I could give you a plugin I built for test purposes. As for the Sophie stuff, well it uses FFI for talking to Quicktime, there is an optional quicktime plugin but all that is used for is to let quicktime tell us when it has rendered a frame into a squeak surface so we can signal a squeak semaphore to draw the surface to the Display. The fall back is to do a fixed frame rate drawing cycle, which is what happens on Windows. The Sophie player of course uses Tweak as a reference base, but could be converted to some other UI framework." Cheers Mariano On Wed, Apr 21, 2010 at 7:10 PM, Bill Rodgers <[hidden email]> wrote: Very cool ! _______________________________________________ Pharo-users mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users |
Thanks Mariano, this information should get me going. I'll circle back in a couple weeks and let the group know how its going.
Bill On Wed, Apr 21, 2010 at 5:46 PM, Mariano Martinez Peck <[hidden email]> wrote: Hi Bill. You have 2 possibilities: _______________________________________________ Pharo-users mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users |
In reply to this post by Mariano Martinez Peck
mariano may be we should turn that in a book section?
Stef On Apr 22, 2010, at 1:46 AM, Mariano Martinez Peck wrote: > Hi Bill. You have 2 possibilities: > > 1) Use FFI. With this you can call C functions from shared libraries. No need to recompile de VM. Main problem: it locks the whole VM while the function is being run. The FFI is included in most VMs so it is easy. What you DO need to install is the smalltalk side of FFI. A simple way in Pharo is evaluating: > > Gofer new > squeaksource: 'MetacelloRepository'; > package: 'ConfigurationOfFFI'; > load. > > ((Smalltalk at: #ConfigurationOfFFI) project version: '1.2') load. > > There are a lot of examples and libraries wrapped with FFI. We developed a wrapper for the OpenDBX library....the project is call SqueakDBX (www.squeakdbx.org) and would be useful if you want a real example using FFI. > > FFI: http://wiki.squeak.org/squeak/1414 > > 2) Write your own named plugin. This is, you write your plugin in SLANG (a limited Smalltallk that it is used to write part of the vm and then translated to C) and then, using VMMaker you generate C code, and after, you can generate the binaries. Finally when you distribute your app you will need to add such plugin to the VM. > > http://wiki.squeak.org/squeak/356 > http://wiki.squeak.org/squeak/464 > > > Particulary for GTK, look at the project (I think it is dead now) SqueakGTK: > > http://squeakgtk.pbworks.com/ > > Particuolary for Gstreamer I paste an email from John Macinstosh some time ago: > > "Well I'm not sure what you are asking for. The Gstreamer stuff starts at: > > MCHttpRepository > location: 'http://www.squeaksource.com/GStreamer' > user: '' > password: '' > > You need a plugin and the GStreamer underpinnings install in your operating system. If you have > have a linux box that is easy. If you have a mac, you could use MacPorts to install GStreamer and > I could give you a plugin I built for test purposes. > > As for the Sophie stuff, well it uses FFI for talking to Quicktime, there is an optional quicktime plugin > but all that is used for is to let quicktime tell us when it has rendered a frame into a squeak surface > so we can signal a squeak semaphore to draw the surface to the Display. The fall back is to > do a fixed frame rate drawing cycle, which is what happens on Windows. > > The Sophie player of course uses Tweak as a reference base, but could be converted to some other > UI framework." > > > Cheers > > Mariano > > > On Wed, Apr 21, 2010 at 7:10 PM, Bill Rodgers <[hidden email]> wrote: > Very cool ! > > Thanks, > > Bill > > > On Wed, Apr 21, 2010 at 1:58 PM, Stéphane Ducasse <[hidden email]> wrote: > Hi bill > > you can use FFI, we should write a chapter. I think that there are some material on the web > > you can define your own plugin. > Have a look for the second on the chapter of the book > http://stephane.ducasse.free.fr/FreeBooks/CollectiveNBlueBook/ > > On Apr 21, 2010, at 6:41 PM, Bill Rodgers wrote: > > > Hi Experts, > > > > How can I connect to libraries of the type that I would "include" in a C program? Must I re-compile Pharo to include them or is there some other way to do this at run-time? > > > > I'm looking at some Gnome libraries (GTK+, Gstreamer) which I would like to use from Pharo. > > John macintosh did a Gstreamer plugin for squeak/sophie/ > > > > Thanks, > > > > Bill > > _______________________________________________ > > Pharo-users mailing list > > [hidden email] > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users > > > _______________________________________________ > Pharo-users mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users > > > _______________________________________________ > Pharo-users mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users > > > _______________________________________________ > Pharo-users mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users _______________________________________________ Pharo-users mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users |
On Thu, Apr 22, 2010 at 4:31 AM, Stéphane Ducasse <[hidden email]> wrote: mariano may be we should turn that in a book section? yes, it would be cool. I think this has been asked several times. Stef _______________________________________________ Pharo-users mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users |
Free forum by Nabble | Edit this page |