Use FFI to dynamically load shared library on Mac OS 10.5

James Foster James at JGFoster.net
Fri Jan 18 21:31:17 UTC 2008


Josh,

Thanks for the idea. My image doesn't have #listLoadedModules. Since  
the code runs on other platforms (Linux/Windows), I think that the  
address could be found. Also, the handle is nil when I inspect the  
object. Interestingly, the #forceLoading method does not report any  
error--even if I give the wrong name!

GciLibrary new forceLoading handle. "@ 16r00000000"
FFITestLibrary new forceLoading handle. "@ 16r0028C830"

James


On Jan 18, 2008, at 1:01 PM, Joshua Gargus wrote:

> The problem may not be that you aren't loading the library, it may  
> be that you're not finding the address of the function within the  
> library.  If you execute 'Smalltalk listLoadedModules' after a  
> failed invocation attempt, does your shared library show up in the  
> list?
>
> Josh
>
>
> On Jan 18, 2008, at 12:55 PM, James Foster wrote:
>
>> I'm trying to dynamically load a shared library (.so) and  
>> consistently get "Unable to find function address." I have tried  
>> putting the library in a variety of locations (next to the  
>> executable, next to the image, next to the FFI package, etc.) and I  
>> have set the environment variable DYLD_LIBRARY_PATH to the location  
>> of the library. Nothing seems to work (although the FFI tests all  
>> pass). Any advice?
>>
>> James Foster
>>
>
>
>




More information about the Squeak-dev mailing list