Use FFI to dynamically load shared library on Mac OS 10.5

John M McIntosh johnmci at smalltalkconsulting.com
Sat Jan 19 01:04:45 UTC 2008


On Jan 18, 2008, at 2:21 PM, James Foster wrote:

> The SqueakDebug flag was very helpful. I now have the message that  
> it found the library but the library had the wrong architecture. Now  
> that I think of it, this seems quite likely--I'm trying to load a 64- 
> bit library into a 32-bit executable. I'll see if I can find a 32- 
> bit library; I bet that will work. Thanks very much.
>
> James

Thanks, I added this feature because diagnosing *why* a FFI call  
didn't work was always most painful, find the library, nope, load the  
library, nope, find the function, nope, oh does the data being passed  
match the api: declare nope....   Lot's of nopes...

Today I noted that sending bad data to fileno() via FFI causes the VM  
to crash, that sounds like a buffer/overflow opportunity. Still the  
intent was
not to segfault, so yes saying longAt: 4   isn't really what you want,  
you want longAt: 5, something about that is that 0 based offseting  or  
1 based?

Just so I can say stat(fileno(squeak fileno),...)   to avoid the  
lengthy time to get modificationTime via reading the entire directory...

>
>
> P.S. It would be nice if #forceLoading actually resulted in an error  
> if the load fails.

The Squeak Mantis system awaits your request.


--
= 
= 
= 
========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
= 
= 
= 
========================================================================





More information about the Squeak-dev mailing list