How to make FFI work?

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

How to make FFI work?

Kirk Fraser
FFI - Foriegn Function Interface example given at http://wiki.squeak.org/squeak/2422 fails to compile under a test class, so it can't work.  The error is expecting a '>' which implies the apicall is wrong.  Since it's example code, it's likely correct and the parser is not working. 
 
I assumed it was a failure of FFI to be installed properly in Squeak 4.2 All-In-One.  I tried the FFI install .st which gave an error about an unrecognized password.  (I have since been unable to locate that code to put the error and link in this post.)  
 
This is confusing since the FFI .dll comes with the All-In-One so it must be used somewhere.
 
Any suggestions?  Getting FFI code to accept is needed in my attempt to load the old video package or try openCV.
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: How to make FFI work?

Levente Uzonyi-2
On Wed, 7 Sep 2011, Overcomer Man wrote:

> FFI - Foriegn Function Interface example given at
> http://wiki.squeak.org/squeak/2422 fails to compile under a test class, so
> it can't work.  The error is expecting a '>' which implies the apicall is
> wrong.  Since it's example code, it's likely correct and the parser is not
> working.

Note that this example only works on Windows and FFI only supports 32-bit
operating systems.

>
> I assumed it was a failure of FFI to be installed properly in Squeak 4.2
> All-In-One.  I tried the FFI install .st which gave an error about an
> unrecognized password.  (I have since been unable to locate that code to put
> the error and link in this post.)

You should use the http://source.squeak.org/FFI Monticello repository to
load FFI. Load FFI-Pools first, then FFI-Kernel. Optionally you can load
the platform code for your OS (FFI-Win32 if you're using windows) and the
tests (FFI-Tests). If you don't want to bother with doing this manually,
then you can use SqueakMap or there's the "Extending te system" item in
the docking bar's Help menu. The second code snippet loads FFI.


Levente

>
> This is confusing since the FFI .dll comes with the All-In-One so it must be
> used somewhere.
>
> Any suggestions?  Getting FFI code to accept is needed in my attempt to load
> the old video package or try openCV.
>
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: How to make FFI work?

Kirk Fraser
In reply to this post by Kirk Fraser
Update.  
I located the FFI install which works with Squeak 4.2 but fails on Cuis 3.3

That failed with this error walkback:
UndefinedObject(Object)>>doesNotUnderstand: #location:user:password:

Juan says it uses Monticello not included in Cuis.  Any suggestions on how to tweak installFFI4.st to work under Cuis?   Thanks.



On Wed, Sep 7, 2011 at 12:27 PM, Overcomer Man <[hidden email]> wrote:
FFI - Foriegn Function Interface example given at http://wiki.squeak.org/squeak/2422 fails to compile under a test class, so it can't work.  The error is expecting a '>' which implies the apicall is wrong.  Since it's example code, it's likely correct and the parser is not working. 
 
I assumed it was a failure of FFI to be installed properly in Squeak 4.2 All-In-One.  I tried the FFI install .st which gave an error about an unrecognized password.  (I have since been unable to locate that code to put the error and link in this post.)  
 
This is confusing since the FFI .dll comes with the All-In-One so it must be used somewhere.
 
Any suggestions?  Getting FFI code to accept is needed in my attempt to load the old video package or try openCV.


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: How to make FFI work?

David T. Lewis
In reply to this post by Levente Uzonyi-2
On Wed, Sep 07, 2011 at 10:41:33PM +0200, Levente Uzonyi wrote:

> On Wed, 7 Sep 2011, Overcomer Man wrote:
>
> >FFI - Foriegn Function Interface example given at
> >http://wiki.squeak.org/squeak/2422 fails to compile under a test class, so
> >it can't work.  The error is expecting a '>' which implies the apicall is
> >wrong.  Since it's example code, it's likely correct and the parser is not
> >working.
>
> Note that this example only works on Windows and FFI only supports 32-bit
> operating systems.

Well, strictly speaking that is not exactly the case:

  http://bugs.squeak.org/view.php?id=7237

FFI does work on 64-bit platforms, but it will take some effort to
make this generally available on the standard VMs.

Dave

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: How to make FFI work?

Kirk Fraser
In reply to this post by Kirk Fraser
Update 2:
I looked at the InstallFFI4.st and discovered http://source.squeakfoundation.org/FFI
 
where I found 'FFI-Kernel-ar.9.mcz', 'FFI-Tests-ar.2.mcz', 'FFI-Examples-ar.1.mcz'
convertable to .zip files by changing the extension.  Then I attempted to fileIn.
Cuis accepted the Kernal and Tests but failed on the Examples due to MacIntosh classes which Cuis doesn't support.

Unfortunately that still was insufficient to accept the example at http://wiki.squeak.org/squeak/2422 but the error is now different:

getFocus
"Return the HWND currently having the input focus"
<apicall:  return type expected ->Win32Window 'GetFocus' (void) module: 'user32.dll'>
^self externalCallFailed

So any advice?  

I'm under the impression Cuis was never intended to use FFI but to do direct binary input without a C.dll but unfortunately the details of how to do that for VideoFlow are also beyond my knowledge.  Where would I learn that?

Thanks,
Kirk Fraser



On Wed, Sep 7, 2011 at 5:53 PM, Overcomer Man <[hidden email]> wrote:
Update.  
I located the FFI install which works with Squeak 4.2 but fails on Cuis 3.3

That failed with this error walkback:
UndefinedObject(Object)>>doesNotUnderstand: #location:user:password:

Juan says it uses Monticello not included in Cuis.  Any suggestions on how to tweak installFFI4.st to work under Cuis?   Thanks.



On Wed, Sep 7, 2011 at 12:27 PM, Overcomer Man <[hidden email]> wrote:
FFI - Foriegn Function Interface example given at http://wiki.squeak.org/squeak/2422 fails to compile under a test class, so it can't work.  The error is expecting a '>' which implies the apicall is wrong.  Since it's example code, it's likely correct and the parser is not working. 
 
I assumed it was a failure of FFI to be installed properly in Squeak 4.2 All-In-One.  I tried the FFI install .st which gave an error about an unrecognized password.  (I have since been unable to locate that code to put the error and link in this post.)  
 
This is confusing since the FFI .dll comes with the All-In-One so it must be used somewhere.
 
Any suggestions?  Getting FFI code to accept is needed in my attempt to load the old video package or try openCV.



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: How to make FFI work?

LawsonEnglish
In reply to this post by Kirk Fraser
On 9/7/11 5:53 PM, Overcomer Man wrote:
Update.  
I located the FFI install which works with Squeak 4.2 but fails on Cuis 3.3

That failed with this error walkback:
UndefinedObject(Object)>>doesNotUnderstand: #location:user:password:

Juan says it uses Monticello not included in Cuis.  Any suggestions on how to tweak installFFI4.st to work under Cuis?   Thanks.



I tried to file-out the FFI packages and then file them into Cuis 3.3, but still no go.

I got a MNU.
Debug stack:

#('UndefinedObject(Object)>>doesNotUnderstand: #noticeModificationOf:' 'ExternalData class(ExternalStructure class)>>doneCompiling' 'ClassBuilder>>doneCompiling:' 'ClassBuilder>>name:subclassOf:type:instanceVariableNames:classVariableNames:poolDictionaries:category:unsafe:' 'ClassBuilder>>name:subclassOf:type:instanceVariableNames:classVariableNames:poolDictionaries:category:' 'ClassBuilder>>superclass:subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:' 'ExternalStructure class(Class)>>subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:' 'UndefinedObject>>DoIt' 'Compiler>>evaluate:in:to:notifying:ifFail:logged:' 'Compiler class>>evaluate:for:notifying:logged:' 'Compiler class>>evaluate:for:logged:' 'Compiler class>>evaluate:logged:' '[] in [] in StandardFileStream(PositionableStream)>>fileInAnnouncing:' 'BlockClosure>>on:do:' '[] in StandardFileStream(PositionableStream)>>fileInAnnouncing:' 'ProgressInitiationException>>defaultAction' 'UndefinedObject>>handleSignal:' 'MethodContext(ContextPart)>>handleSignal:' 'ProgressInitiationException(Exception)>>signal' 'ProgressInitiationException>>display:at:from:to:during:' 'ProgressInitiationException class>>display:at:from:to:during:' 'String>>displayProgressAt:from:to:during:' 'StandardFileStream(PositionableStream)>>fileInAnnouncing:' 'StandardFileStream(FileStream)>>fileIn' 'FileStream class>>fileIn:' 'SimpleServiceEntry>>performService' 'PluggableButtonMorph>>performAction' 'PluggableButtonMorph>>mouseUp:' 'PluggableButtonMorph(Morph)>>handleMouseUp:' 'MouseButtonEvent>>sentTo:' 'PluggableButtonMorph(Morph)>>handleEvent:' 'PluggableButtonMorph(Morph)>>handleFocusEvent:' '[] in HandMorph>>sendFocusEvent:to:in:' '[] in PasteUpMorph>>becomeActiveDuring:' 'BlockClosure>>on:do:' 'PasteUpMorph>>becomeActiveDuring:' 'HandMorph>>sendFocusEvent:to:in:' 'HandMorph>>sendMouseEvent:' 'HandMorph>>handleEvent:' 'MouseClickState>>handleEvent:from:' 'HandMorph>>handleEvent:' 'HandMorph>>processEvents' '[] in WorldState>>doOneCycleNowFor:' 'Array(SequenceableCollection)>>do:' 'WorldState>>handsDo:' 'WorldState>>doOneCycleNowFor:' 'WorldState>>doOneCycleFor:' 'PasteUpMorph>>doOneCycle' '[] in ProjectX class>>spawnNewProcessX' '[] in BlockClosure>>newProcess')
L.

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners