We might be able to introduce a way to look for a mangled match, proceeding if 
it it unique, or something like that??  I have just dealt with it by finding 
the exported name and putting in the call definition.




________________________________________
From: [email protected] 
[[email protected]] On Behalf Of laurent laffont 
[[email protected]]
Sent: Friday, May 06, 2011 4:44 PM
To: [email protected]
Subject: Re: [Pharo-project] Popularity of Smalltalk in Software Industry

On Fri, May 6, 2011 at 9:16 PM, Schwab,Wilhelm K 
<[email protected]<mailto:[email protected]>> wrote:
Laurent,

I am starting to understand your pain, or at least how it manifests itself in 
my world.  First, the search path for libraries (Unix VM) can be a problem, not 
because of how it works, but because it does not tell me what it is trying to 
do.  IMHO, any time the vm translates something (library name to search path, 
COM port name to number or vice versa), it should describe what it did, perhaps 
only if the attempt to open/load/whatever fails (if a load works, I'm probably 
happy and not looking).  I have been known to hack the vm to add such tracing - 
syslog, stdout - wherever, but somewhere.

Yes. I remember some mails you sent on this subject some months ago.


Mangled names are another topic, but I do NOT consider this to be a 
Squeak/Pharo/VM failing of any type.  The author of the library failed to use 
extern "C" - simple as that.

I wonder why Python / Ruby can manage mangled names and that FFI don't. Because 
it's a real pain.

Laurent.


The most recent encounter I had with this was on Windows, and I left behind the 
following comment:

       The conspicuous (in hindsight) absence of extern "C" from
       the header file comes at a price: the names are mangled.
       Enter pexports.exe and some copy/paste with periodic
       acerbic remarks.

Translation: if you have not done this, consider using pexports.exe to obtain 
the true exported symbol names, and put them (with ?@, etc. intact) in your FFI 
definitions.  HTH.

Bill


________________________________________
From: 
[email protected]<mailto:[email protected]>
 
[[email protected]<mailto:[email protected]>]
 On Behalf Of laurent laffont 
[[email protected]<mailto:[email protected]>]
Sent: Friday, May 06, 2011 2:34 PM
To: 
[email protected]<mailto:[email protected]>
Subject: Re: [Pharo-project] Popularity of Smalltalk in Software Industry

On Fri, May 6, 2011 at 8:06 PM, Schwab,Wilhelm K 
<[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>>
 wrote:
No real agenda either way here, except to say that we almost have that in FFI.  
If you know enough to make the call, do you not know enough to write the FFI 
wrapper?  Just asking.  Having stirred the broth, I'll shut up and learn :)



My last attempts:
http://forum.world.st/Re-Z3950-on-OSX-module-yaz3-not-found-tp3161332p3161332.html
http://forum.world.st/Re-FFI-crashes-VM-on-Linux-was-Z3950-on-OSX-module-yaz3-not-found-td3163001.html

Any help appreciated.

Laurent.




________________________________________
From: 
[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>
 
[[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>]
 On Behalf Of laurent laffont 
[[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>]
Sent: Friday, May 06, 2011 1:47 PM
To: 
[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>
Subject: Re: [Pharo-project] Popularity of Smalltalk in Software Industry

On Fri, May 6, 2011 at 7:25 PM, Igor Stasenko 
<[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>><mailto:[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>>>
 wrote:
On 6 May 2011 18:45, laurent laffont 
<[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>><mailto:[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>>>
 wrote:
> On Fri, May 6, 2011 at 4:01 PM, Igor Stasenko 
> <[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>><mailto:[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>>>
>  wrote:
>>
>> Is it works because someone already provided a bindings for libraries
>> you mention,
>> or you did it by yourself?
>
> Have just used ctypes:
>>>> import ctypes
>>>> import ctypes.util
>>>> ctypes.util.find_library("yaz")
> '/usr/local/lib/libyaz.dylib'
>>>> yaz = ctypes.cdll.LoadLibrary("libyaz.dylib")
>>>> con = 
>>>> yaz.ZOOM_connection_new("z3950.loc.gov<http://z3950.loc.gov><http://z3950.loc.gov><http://z3950.loc.gov>",
>>>>  7090);

oh cool.. give me a 5 minutes to load external library, look up the
random symbol exported by it
and make a call to it with random number of arguments, and expect it
won't crash.

Works outta box! Cool.

Now serious. How about spending time writing a bindings for that library?
Where you have properly organized classes/interfaces, error handling
and other stuff.
No takers?

Seriously, if you want such kind of shitty interface, which allows you
to call arbitrary function with arbitrary arguments
without any argument type checking, i can write it for you.


Do it, please do it. Seriously. Thanks

Laurent.



> Laurent

--
Best regards,
Igor Stasenko AKA sig.







Reply via email to