Pharo-users
By thread
pharo-users@lists.pharo.org
By month
Messages by month
- ----- 2026 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
May 2010
- 29 participants
- 155 messages
Re: [Pharo-users] [ANN] Traits installer/uninstaller utility
by Tudor Girba
Hi Johan,
I took a quick look and it looks interesting.
Just a note for discussion. Executing "AspectMapsUI open" installs the
traits. One of your trait extension is adding TAMStructuralZoom to
FAMIXClass.
Now, when I browse the FAMIXClass, I get this in the browser:
-----
FAMIXType subclass: #FAMIXClass
uses: TAMStructuralZoom
instanceVariableNames: 'isInterface'
classVariableNames: ''
poolDictionaries: ''
category: 'Famix-Core'
-----
There are two problems with this:
1. So, now if I just want to edit the base class, I have to take care
and delete the Trait before, because the Trait is part of the
definition.
This is a limitation of the browser, but we have to pay attention to it.
2. If you look in Monticello, the base package (FAMIX-Core in this
case) is not dirty, but if you explicitly look for Changes, it gets
dirty. I do not know how this could be solved. Perhaps we need
extension as first class?
Cheers,
Doru
On 16 May 2010, at 02:36, Johan Fabry wrote:
> Hi all,
>
> this is a small package that I wrote after doing a traits-based
> refactoring of AspectMaps (Plug: Check out AspectMaps for a cool
> visualization of Aspects. http://pleiad.cl/aspectmaps. It has nice
> screencasts. All comments welcome!)
>
> AspectMaps extends a number of classes of FAMIX to do its thing,
> using standard class extensions. This works OK when you are not
> using traits. But when using a trait, you need to redef the class,
> i.e. change the original package (in this case one of the moose
> packages). A big no-no. This kind of change should also be
> encapusulated in the AspectMaps package, but currently this is not
> possible. So, as long as traits and packages dont play well
> together, these kinds of refactorings are out.
>
> However not so when you are using the TraitsApplication package.
> This package provides a means to programmatically install/uninstall
> traits. Call it in a post-load action on a package (if such a thing
> exists), in a class initialize method, et cetera (for AspectMaps I
> do it in the AspectMaps>>open method). I thought this could be
> useful to some members of the community so I am releasing it
> publicly. You can find it at http://www.squeaksource.com/TraitsApplication
>
> CAVEAT: This is a quick implementation, it is non-optimal. It can be
> made much more elegant, but that requires time that I dont have
> right now :-(. I does not handle fancy trait compositions (yet). I
> give no guarantees other than that
> 1) it passes all of its tests
> 2) it works for me :-)
>
> So check it out. Comments are welcome!
> --
> Johan Fabry
> jfabry(a)dcc.uchile.cl - http://dcc.uchile.cl/~jfabry
> PLEIAD Lab - Computer Science Department (DCC) - University of Chile
>
>
>
>
> _______________________________________________
> Pharo-users mailing list
> Pharo-users(a)lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
--
www.tudorgirba.com
"Speaking louder won't make the point worthier."
May 16, 2010
Re: [Pharo-users] [Vm-dev] Fwd: Need help with Alien, unexpected function return value
by Joachim Geidel
Steve,
>>> result := (Alien newGC: 4) pointer.
>>> functionPointer
>>> primFFICallResult: result
>>> with: self asJNIParameter.
>>> ^result signedIntAt: 1
[snip]
> When you use a pointer alien (which has a size field of zero) as the
> return result of a function call, the alien code expects the result from
> the alien to be a pointer to some area of memory and replaces the
> address field of the result alien with the result returned by the
> function call. You're lucky your method returned any result at all
> rather than crashing with an access violation - you are dereferencing
> whatever sits at 0x00010006.
[snip]
>>> result := (Alien newC: 4).
>>> functionPointer
>>> primFFICallResult: result pointer
>>> with: self asJNIParameter.
>>> ^result signedIntAt: 1
[snip]
> This time you are returning the signed int at the block of memory
> allocated by the newC: call. The memory gets zeroed before use, which is
> why you get a zero. Because you used "result pointer" in the alien call
> the alien code again replaces the pointer alien's address with the
> result. This time though, you don't have a reference to the pointer
> alien, so the result is effectively discarded.
Thanks a lot for the explanation!
Am 16.05.10 03:58 schrieb Steve Rees:
> Try the following
>
> result := (Alien new: 4).
> functionPointer
> primFFICallResult: result
> with: self asJNIParameter.
> ^result signedIntAt: 1
Yes, that's it. I get the expected result now.
I'll have to inspect the rest of my (ab)use of Aliens now, but that
shouldn't take long. After that I'll have to find out where I should
explicitly free Aliens and where the garbage collector will do that for me.
I am sure I have built in some nice memory leaks. :-)
Thanks again!
Joachim
May 16, 2010
Newbie: Does Socket ping: 'addr' work in Pharo3.11.8 ?
by RickT
I installed the one-click version on Windows (XP) recently and am learning
Smalltalk. I am under the impression that in a Shout Workspace I can
execute the line
Socket ping: 'localhost'
(or some valid address). But I always get a message that it timed out. I
can successfully ping the same address in a command window. Any guidance
would be appreciated.
--
View this message in context: http://forum.world.st/Newbie-Does-Socket-ping-addr-work-in-Pharo3-11-8-tp22…
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
May 16, 2010
[ANN] Traits installer/uninstaller utility
by Johan Fabry
Hi all,
this is a small package that I wrote after doing a traits-based refactoring of AspectMaps (Plug: Check out AspectMaps for a cool visualization of Aspects. http://pleiad.cl/aspectmaps. It has nice screencasts. All comments welcome!)
AspectMaps extends a number of classes of FAMIX to do its thing, using standard class extensions. This works OK when you are not using traits. But when using a trait, you need to redef the class, i.e. change the original package (in this case one of the moose packages). A big no-no. This kind of change should also be encapusulated in the AspectMaps package, but currently this is not possible. So, as long as traits and packages dont play well together, these kinds of refactorings are out.
However not so when you are using the TraitsApplication package. This package provides a means to programmatically install/uninstall traits. Call it in a post-load action on a package (if such a thing exists), in a class initialize method, et cetera (for AspectMaps I do it in the AspectMaps>>open method). I thought this could be useful to some members of the community so I am releasing it publicly. You can find it at http://www.squeaksource.com/TraitsApplication
CAVEAT: This is a quick implementation, it is non-optimal. It can be made much more elegant, but that requires time that I dont have right now :-(. I does not handle fancy trait compositions (yet). I give no guarantees other than that
1) it passes all of its tests
2) it works for me :-)
So check it out. Comments are welcome!
--
Johan Fabry
jfabry(a)dcc.uchile.cl - http://dcc.uchile.cl/~jfabry
PLEIAD Lab - Computer Science Department (DCC) - University of Chile
May 16, 2010
Need help with Alien, unexpected function return value
by Joachim Geidel
Hello everybody,
I need some help with Alien on Mac OS X 10.6.3 in Pharo 1.0. I am calling a
function from a vtable struct in the Java Native Interface of the Java VM
which comes with Mac OS X and which is defined as
jint ( __stdcall * GetVersion)(JNIEnv * env);
The result type jint is just an alias for int. The Smalltalk method is
----
primGetVersion
| functionPointer result vtablePointer |
vtablePointer := Alien
atAddress: self externalData asUnsignedLong
dataSize: Alien sizeofPointer * self vtableSize.
functionPointer := Alien forPointer:
(vtablePointer unsignedLongAt: (4 * Alien sizeofPointer + 1)).
result := (Alien newGC: 4) pointer.
functionPointer
primFFICallResult: result
with: self asJNIParameter.
^result signedIntAt: 1
----
functionPointer is the pointer to the GetVersion function.
The result should be 65542 (16r00010006), which is also what I get when
calling the function from VisualWorks, but the method answers -394042288
(-16r177C9BB0). The "result" Alien has the printString '#[0 0 0 0 6 0 1 0]'
which suspiciously contains the 1 and the 6 I am looking for, but in the
wrong places. ;-)
I looked at examples for callouts, which seem to indicate that result should
be the Alien and not a pointer to it. So I changed the code to
----
result := (Alien newC: 4).
functionPointer
primFFICallResult: result pointer
with: self asJNIParameter.
^result signedIntAt: 1
----
This didn't really help. The result is now 0 (zero), although the Alien
prints as #[252 255 255 255 80 15 38 0] which doesn't look like a 0 at first
sight.
Am I using those Aliens in a correct way? What can I try to debug this?
If this is too obscure and someone who knows about Aliens would like to have
a look at the rest of the code, I am willing to send a bunch of Monticello
packages and instructions for reproducing the problem, but I won't make it
publicly available yet.
Any help is welcome.
Best regards,
Joachim Geidel
--
View this message in context: http://forum.world.st/Need-help-with-Alien-unexpected-function-return-value…
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
May 15, 2010
Re: [Pharo-users] Using FFI to call a MacOs System function
by Mariano Martinez Peck
On Sat, May 15, 2010 at 8:42 PM, David Wilson <djwilson(a)bluewin.ch> wrote:
> Hi Mariano
>
> I now see that my solution (yesterday) was a hack.
>
hahhaha I though that when I read it ;)
But as I don't know how it is, I didn't say anything.
> John Macintosh' post (
> http://forum.world.st/Re-Pharo-users-Using-FFI-to-call-a-MacOs-System-funct…)
> shows how to do this properly.
> If I do something with this (ie gain real experience) then I'll look at
> working on the documentation.
>
>
Excellent!
> Cheers
>
> David
>
>
> On 14 May, 2010, at 20:16, Mariano Martinez Peck wrote:
>
>
>
>> Let us know your progress. Now...would you like to help us and document
>> all this in http://book.seaside.st/ ?
>>
>
>
> Sorry I mean http://book.pharo-project.org/ ;) too many books
>
>
>
>
>> We need to write all this down. Image the poor guy that comes after
>> you...imagine if someone already had this problem and you would have found
>> such info...wouldn't that be cool ? Don't worry for the English neither to
>> the text. It doesn't need to be perfect. This is continuous...we first
>> write, and then the community will give feedback, correct it, complete it,
>> etc...
>>
>> If you want to join, please let us know and we generate a user for you.
>>
>> Cheers
>>
>> Mariano
>>
>> Cheers
>>>
>>> David
>>>
>>>
>>>
>>>
>>>
>>> On 05 May, 2010, at 23:15, Mariano Martinez Peck wrote:
>>>
>>> BTW....keyboards seems to be a .h (a header) , but not a library...at
>>> least in my mac
>>>
>>> Do you have also the library ? I am still newbie with the Mac OS :(
>>>
>>> Cheers
>>>
>>> mariano
>>>
>>> On Wed, May 5, 2010 at 11:10 PM, Mariano Martinez Peck <
>>> marianopeck(a)gmail.com> wrote:
>>>
>>>>
>>>>
>>>> On Tue, May 4, 2010 at 4:46 PM, David Wilson <djwilson(a)bluewin.ch>wrote:
>>>>
>>>>> Hi
>>>>>
>>>>> I'm new to Pharo (although I was a Smalltalk programmer in the 90's),
>>>>> and I'm trying to use FFI to access an MacOs system function:
>>>>>
>>>>>
>>>> Hi and welcome!
>>>>
>>>>
>>>>> apiKLGetKeyboardLayoutCount
>>>>> < cdecl: ulong 'KLGetKeyboardLayoutCount' (void) module:
>>>>> 'keyboards'>
>>>>> ^ self externalCallFailed.
>>>>>
>>>>> I get an error "'Unable to find function address'" which seems to say
>>>>> the OS-module "keyboards" can't be found.
>>>>>
>>>>
>>>> Exactly. That's the problem.
>>>>
>>>>
>>>>> I can't figure out what the address should be.
>>>>> The function is defined here:
>>>>> http://developer.apple.com/legacy/mac/library/documentation/Carbon/Referenc…
>>>>> (yes, it's deprecated, I have a very old mac runnning 10.4).
>>>>>
>>>>>
>>>> But you see the library in your computer, isn't it ? I mean, it is
>>>> there, but FFI doesn't find it ?
>>>>
>>>>
>>>>
>>>>> I'm not sure if I'm using FFI correctly, do I have to somehow include
>>>>> the external library in the Pharo VM?
>>>>>
>>>>
>>>> No, you shouldn't need to do that. However, you can try to put them
>>>> there just to see if that's the problem. I think that at some point (depends
>>>> on an order) the library is searched in the same place where you are calling
>>>> from. So, yes, do a test, but just a test. It should work without doing
>>>> that.
>>>>
>>>> How did you install FFI ? Which Pharo VM and image versions are you
>>>> using ?
>>>>
>>>> Can anyone help?
>>>>>
>>>>>
>>>> I would like too, but I don't have such library.
>>>>
>>>> I developed a wrapper for a Clibrary called OpenDBX using FFI. In our
>>>> website, some people experimented similar problems.
>>>> Please take a look to the title "Problems with Mac OS:" of the
>>>> following link:
>>>>
>>>> http://www.squeakdbx.org/Compiling%20and%20installing%20OpenDBX
>>>>
>>>> I also cc'ed people that can help you.
>>>>
>>>> Cheers
>>>>
>>>> Mariano
>>>>
>>>>
>>>> I'm looked for FFI examples, but don't find anything helpful.
>>>>>
>>>>> David
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Pharo-users mailing list
>>>>> Pharo-users(a)lists.gforge.inria.fr
>>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>>>>>
>>>>
>>>>
>>> _______________________________________________
>>> Pharo-users mailing list
>>> Pharo-users(a)lists.gforge.inria.fr
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>>>
>>>
>>> _______________________________________________
>>> Pharo-users mailing list
>>> Pharo-users(a)lists.gforge.inria.fr
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>>>
>>>
>>
> _______________________________________________
> Pharo-users mailing list
> Pharo-users(a)lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>
>
> _______________________________________________
> Pharo-users mailing list
> Pharo-users(a)lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>
>
May 15, 2010
Re: [Pharo-users] Using FFI to call a MacOs System function
by David Wilson
Hi Mariano
I now see that my solution (yesterday) was a hack.
John Macintosh' post (http://forum.world.st/Re-Pharo-users-Using-FFI-
to-call-a-MacOs-System-function-tt2131691.html#a2217998) shows how to
do this properly.
If I do something with this (ie gain real experience) then I'll look
at working on the documentation.
Cheers
David
On 14 May, 2010, at 20:16, Mariano Martinez Peck wrote:
Let us know your progress. Now...would you like to help us and
document all this in http://book.seaside.st/ ?
Sorry I mean http://book.pharo-project.org/ ;) too many books
We need to write all this down. Image the poor guy that comes after
you...imagine if someone already had this problem and you would have
found such info...wouldn't that be cool ? Don't worry for the
English neither to the text. It doesn't need to be perfect. This is
continuous...we first write, and then the community will give
feedback, correct it, complete it, etc...
If you want to join, please let us know and we generate a user for you.
Cheers
Mariano
Cheers
David
On 05 May, 2010, at 23:15, Mariano Martinez Peck wrote:
BTW....keyboards seems to be a .h (a header) , but not a
library...at least in my mac
Do you have also the library ? I am still newbie with the Mac OS :(
Cheers
mariano
On Wed, May 5, 2010 at 11:10 PM, Mariano Martinez Peck
<marianopeck(a)gmail.com> wrote:
On Tue, May 4, 2010 at 4:46 PM, David Wilson <djwilson(a)bluewin.ch>
wrote:
Hi
I'm new to Pharo (although I was a Smalltalk programmer in the 90's),
and I'm trying to use FFI to access an MacOs system function:
Hi and welcome!
apiKLGetKeyboardLayoutCount
< cdecl: ulong 'KLGetKeyboardLayoutCount' (void) module:
'keyboards'>
^ self externalCallFailed.
I get an error "'Unable to find function address'" which seems to say
the OS-module "keyboards" can't be found.
Exactly. That's the problem.
I can't figure out what the address should be.
The function is defined here: http://developer.apple.com/legacy/mac/
library/documentation/Carbon/Reference/KeyboardLayoutServices/
Reference/reference.html
(yes, it's deprecated, I have a very old mac runnning 10.4).
But you see the library in your computer, isn't it ? I mean, it is
there, but FFI doesn't find it ?
I'm not sure if I'm using FFI correctly, do I have to somehow include
the external library in the Pharo VM?
No, you shouldn't need to do that. However, you can try to put them
there just to see if that's the problem. I think that at some point
(depends on an order) the library is searched in the same place where
you are calling from. So, yes, do a test, but just a test. It should
work without doing that.
How did you install FFI ? Which Pharo VM and image versions are you
using ?
Can anyone help?
I would like too, but I don't have such library.
I developed a wrapper for a Clibrary called OpenDBX using FFI. In our
website, some people experimented similar problems.
Please take a look to the title "Problems with Mac OS:" of the
following link:
http://www.squeakdbx.org/Compiling%20and%20installing%20OpenDBX
I also cc'ed people that can help you.
Cheers
Mariano
I'm looked for FFI examples, but don't find anything helpful.
David
_______________________________________________
Pharo-users mailing list
Pharo-users(a)lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
_______________________________________________
Pharo-users mailing list
Pharo-users(a)lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
_______________________________________________
Pharo-users mailing list
Pharo-users(a)lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
_______________________________________________
Pharo-users mailing list
Pharo-users(a)lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
May 15, 2010
Re: [Pharo-users] Resolving some dependencies...
by Mariano Martinez Peck
Done. Check http://www.squeaksource.com/PharoMorphicExtras.html
On Wed, May 12, 2010 at 10:08 PM, Stéphane Ducasse <
stephane.ducasse(a)inria.fr> wrote:
> We should edit the project wiki to say that and also the status to private
> so that PharoMorphicExtras is just
> there for archival purposes.
>
> Setf
>
> On May 12, 2010, at 5:18 PM, Mariano Martinez Peck wrote:
>
> > Carla: some time ago with stef we moved the working packages form
> http://www.squeaksource.com/PharoMorphicExtras to
> >
> > http://www.squeaksource.com/PharoNonCorePackages
> >
> > As you can see in PharoNonCorePackages it is no more MorphicExtras.
> > In addition, we did ConfigurationOfPharoMorphicExtras
> >
> > So please, from nowon, use that repository. And in case of changing
> something, commit it there, as the next dev images will use
> PharoNonCorePackages and not PharoMorphicExtras.
> >
> > Cheers
> >
> > Mariano
> >
> >
> > On Mon, May 10, 2010 at 7:15 PM, Stéphane Ducasse <
> stephane.ducasse(a)inria.fr> wrote:
> > ExtraMorphs?
> > On May 10, 2010, at 5:15 PM, Mariano Martinez Peck wrote:
> >
> > >
> > >
> > > On Mon, May 10, 2010 at 5:09 PM, Carla F. Griggio <
> carla.griggio(a)gmail.com> wrote:
> > > Uff, then... I'll have to do some work over this :)
> > >
> > > About MorphicExtras, if you say it's a lot of crap, I trust you.
> > >
> > > me too.
> > >
> > > But the name of ConfigurationOfPharoMorphicExtras suggests that it will
> load MorphicExtras (at least for me, because I had the package name 'Morphic
> Extras' stucked in my head when I found the metacello configuration) :$ So
> that might be a little confusing.
> > >
> > > That's exactly why I asked. Stef, Carla, do you have a better name for
> such configuration ?
> > >
> > > Cheers
> > >
> > > Mariano
> > >
> > >
> > >
> > > Thanks!
> > >
> > > Carla
> > >
> > >
> > > On Mon, May 10, 2010 at 8:03 AM, Stéphane Ducasse <
> stephane.ducasse(a)inria.fr> wrote:
> > > >
> > > > >
> > > > > PS: When I used ConfigurationOfPharoMorphicExtras, it loaded some
> Morphic packages but not the MorphicExtras package itself, I had to load it
> manually later. Is that OK?
> > > >
> > > > Yes because MorphicExtras-StephaneDucasse.144 is a dead package. It
> is full of crap or experimental code.
> > >
> > >
> > >
> > > >
> > > >
> > > > But anyway, I think she is right.
> > >
> > > she is not
> > >
> > > > The package MorphicExtras should be loaded, together with
> MorphExamplesAndDemos and LED, shouldn't it ?
> > >
> > > No it should NOT!
> > > Check the classes in there and you will see that you do NOT want that
> in your image. :)
> > > What I did was to extract the MorphExampleAndDemos where I cleaned the
> code made sure that the xamples
> > > are working......
> > >
> > > So MorphicExtras should just be there so that people can extract
> something that they would like to repackage. Period.
> > >
> > > >
> > > > Cheers
> > > >
> > > > mariano
> > > >
> > > >
> > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > _______________________________________________
> > > > > Pharo-users mailing list
> > > > > Pharo-users(a)lists.gforge.inria.fr
> > > > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
> > > >
> > > >
> > > > _______________________________________________
> > > > Pharo-users mailing list
> > > > Pharo-users(a)lists.gforge.inria.fr
> > > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
> > > >
> > > > _______________________________________________
> > > > Pharo-users mailing list
> > > > Pharo-users(a)lists.gforge.inria.fr
> > > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
> > >
> > >
> > > _______________________________________________
> > > Pharo-users mailing list
> > > Pharo-users(a)lists.gforge.inria.fr
> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
> > >
> > >
> > > _______________________________________________
> > > Pharo-users mailing list
> > > Pharo-users(a)lists.gforge.inria.fr
> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
> > >
> > >
> > > _______________________________________________
> > > Pharo-users mailing list
> > > Pharo-users(a)lists.gforge.inria.fr
> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
> >
> >
> > _______________________________________________
> > Pharo-users mailing list
> > Pharo-users(a)lists.gforge.inria.fr
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
> >
> > _______________________________________________
> > Pharo-users mailing list
> > Pharo-users(a)lists.gforge.inria.fr
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>
>
> _______________________________________________
> Pharo-users mailing list
> Pharo-users(a)lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>
May 14, 2010
Re: [Pharo-users] Using FFI to call a MacOs System function
by Mariano Martinez Peck
>
> Let us know your progress. Now...would you like to help us and document all
> this in http://book.seaside.st/ ?
>
Sorry I mean http://book.pharo-project.org/ ;) too many books
> We need to write all this down. Image the poor guy that comes after
> you...imagine if someone already had this problem and you would have found
> such info...wouldn't that be cool ? Don't worry for the English neither to
> the text. It doesn't need to be perfect. This is continuous...we first
> write, and then the community will give feedback, correct it, complete it,
> etc...
>
> If you want to join, please let us know and we generate a user for you.
>
> Cheers
>
> Mariano
>
> Cheers
>>
>> David
>>
>>
>>
>>
>>
>> On 05 May, 2010, at 23:15, Mariano Martinez Peck wrote:
>>
>> BTW....keyboards seems to be a .h (a header) , but not a library...at
>> least in my mac
>>
>> Do you have also the library ? I am still newbie with the Mac OS :(
>>
>> Cheers
>>
>> mariano
>>
>> On Wed, May 5, 2010 at 11:10 PM, Mariano Martinez Peck <
>> marianopeck(a)gmail.com> wrote:
>>
>>>
>>>
>>> On Tue, May 4, 2010 at 4:46 PM, David Wilson <djwilson(a)bluewin.ch>wrote:
>>>
>>>> Hi
>>>>
>>>> I'm new to Pharo (although I was a Smalltalk programmer in the 90's),
>>>> and I'm trying to use FFI to access an MacOs system function:
>>>>
>>>>
>>> Hi and welcome!
>>>
>>>
>>>> apiKLGetKeyboardLayoutCount
>>>> < cdecl: ulong 'KLGetKeyboardLayoutCount' (void) module:
>>>> 'keyboards'>
>>>> ^ self externalCallFailed.
>>>>
>>>> I get an error "'Unable to find function address'" which seems to say
>>>> the OS-module "keyboards" can't be found.
>>>>
>>>
>>> Exactly. That's the problem.
>>>
>>>
>>>> I can't figure out what the address should be.
>>>> The function is defined here:
>>>> http://developer.apple.com/legacy/mac/library/documentation/Carbon/Referenc…
>>>> (yes, it's deprecated, I have a very old mac runnning 10.4).
>>>>
>>>>
>>> But you see the library in your computer, isn't it ? I mean, it is there,
>>> but FFI doesn't find it ?
>>>
>>>
>>>
>>>> I'm not sure if I'm using FFI correctly, do I have to somehow include
>>>> the external library in the Pharo VM?
>>>>
>>>
>>> No, you shouldn't need to do that. However, you can try to put them there
>>> just to see if that's the problem. I think that at some point (depends on an
>>> order) the library is searched in the same place where you are calling from.
>>> So, yes, do a test, but just a test. It should work without doing that.
>>>
>>> How did you install FFI ? Which Pharo VM and image versions are you
>>> using ?
>>>
>>> Can anyone help?
>>>>
>>>>
>>> I would like too, but I don't have such library.
>>>
>>> I developed a wrapper for a Clibrary called OpenDBX using FFI. In our
>>> website, some people experimented similar problems.
>>> Please take a look to the title "Problems with Mac OS:" of the following
>>> link:
>>>
>>> http://www.squeakdbx.org/Compiling%20and%20installing%20OpenDBX
>>>
>>> I also cc'ed people that can help you.
>>>
>>> Cheers
>>>
>>> Mariano
>>>
>>>
>>> I'm looked for FFI examples, but don't find anything helpful.
>>>>
>>>> David
>>>>
>>>>
>>>> _______________________________________________
>>>> Pharo-users mailing list
>>>> Pharo-users(a)lists.gforge.inria.fr
>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>>>>
>>>
>>>
>> _______________________________________________
>> Pharo-users mailing list
>> Pharo-users(a)lists.gforge.inria.fr
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>>
>>
>> _______________________________________________
>> Pharo-users mailing list
>> Pharo-users(a)lists.gforge.inria.fr
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>>
>>
>
May 14, 2010
Re: [Pharo-users] Using FFI to call a MacOs System function
by Mariano Martinez Peck
On Fri, May 14, 2010 at 7:04 PM, David Wilson <djwilson(a)bluewin.ch> wrote:
> Hi Mariano
>
> Thanks for the tips, you got me on the right track. Some trial and lots of
> error got me to a solution.
>
>
Hi David. I am glad it worked.
> In order to use MacOs system calls you have to:
> 1) identify the function you want to use e.g. KLGetKeyboardLayoutCount
> 2) find out what header file this is defined in. here it's "Keyboards.h" in
> the Framework "Carbon/Carbon.h"
> So far it's easy from the Apple documentation
>
> 3) find out which Bundle this is in. I used Finder to find out where
> Keyboards.h is used, it's used in HIToolbox.framework
> 4) find the actual compiled framework, on my system it's at:
>
> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox
> 5) I placed a copy of this file in the Pharo bundle at:
> Pharo-1.0.app/Contents/Resources/HIToolbox
>
> An the call looks like:
>
> apiKLGetKeyboardLayoutCount
> < cdecl: ulong 'KLGetKeyboardLayoutCount' (void) module: 'HIToolbox'>
>
> ^ self externalCallFailed.
>
> I tried a link to the bundle, that didn't work.
> Probably the correct way to do this is to change Pharos RES path (in
> Pharo.sh) to include the a pointer to HIToolbox executable.
> I may try that if I go further with this than a prototype.
>
>
Let us know your progress. Now...would you like to help us and document all
this in http://book.seaside.st/ ?
We need to write all this down. Image the poor guy that comes after
you...imagine if someone already had this problem and you would have found
such info...wouldn't that be cool ? Don't worry for the English neither to
the text. It doesn't need to be perfect. This is continuous...we first
write, and then the community will give feedback, correct it, complete it,
etc...
If you want to join, please let us know and we generate a user for you.
Cheers
Mariano
Cheers
>
> David
>
>
>
>
>
> On 05 May, 2010, at 23:15, Mariano Martinez Peck wrote:
>
> BTW....keyboards seems to be a .h (a header) , but not a library...at
> least in my mac
>
> Do you have also the library ? I am still newbie with the Mac OS :(
>
> Cheers
>
> mariano
>
> On Wed, May 5, 2010 at 11:10 PM, Mariano Martinez Peck <
> marianopeck(a)gmail.com> wrote:
>
>>
>>
>> On Tue, May 4, 2010 at 4:46 PM, David Wilson <djwilson(a)bluewin.ch> wrote:
>>
>>> Hi
>>>
>>> I'm new to Pharo (although I was a Smalltalk programmer in the 90's), and
>>> I'm trying to use FFI to access an MacOs system function:
>>>
>>>
>> Hi and welcome!
>>
>>
>>> apiKLGetKeyboardLayoutCount
>>> < cdecl: ulong 'KLGetKeyboardLayoutCount' (void) module: 'keyboards'>
>>> ^ self externalCallFailed.
>>>
>>> I get an error "'Unable to find function address'" which seems to say the
>>> OS-module "keyboards" can't be found.
>>>
>>
>> Exactly. That's the problem.
>>
>>
>>> I can't figure out what the address should be.
>>> The function is defined here:
>>> http://developer.apple.com/legacy/mac/library/documentation/Carbon/Referenc…
>>> (yes, it's deprecated, I have a very old mac runnning 10.4).
>>>
>>>
>> But you see the library in your computer, isn't it ? I mean, it is there,
>> but FFI doesn't find it ?
>>
>>
>>
>>> I'm not sure if I'm using FFI correctly, do I have to somehow include the
>>> external library in the Pharo VM?
>>>
>>
>> No, you shouldn't need to do that. However, you can try to put them there
>> just to see if that's the problem. I think that at some point (depends on an
>> order) the library is searched in the same place where you are calling from.
>> So, yes, do a test, but just a test. It should work without doing that.
>>
>> How did you install FFI ? Which Pharo VM and image versions are you using
>> ?
>>
>> Can anyone help?
>>>
>>>
>> I would like too, but I don't have such library.
>>
>> I developed a wrapper for a Clibrary called OpenDBX using FFI. In our
>> website, some people experimented similar problems.
>> Please take a look to the title "Problems with Mac OS:" of the following
>> link:
>>
>> http://www.squeakdbx.org/Compiling%20and%20installing%20OpenDBX
>>
>> I also cc'ed people that can help you.
>>
>> Cheers
>>
>> Mariano
>>
>>
>> I'm looked for FFI examples, but don't find anything helpful.
>>>
>>> David
>>>
>>>
>>> _______________________________________________
>>> Pharo-users mailing list
>>> Pharo-users(a)lists.gforge.inria.fr
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>>>
>>
>>
> _______________________________________________
> Pharo-users mailing list
> Pharo-users(a)lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>
>
> _______________________________________________
> Pharo-users mailing list
> Pharo-users(a)lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>
>
May 14, 2010