On Wed, 15 Sep 2010, Schwab,Wilhelm K wrote:

Levente,

FFI, Linux.  The point is that the code fails silently when given a string and performs 
as expected when given a byte array.  That is all the more unusual given that the pointer 
is typed as char* (if anything, I would expect the string to succeed).  Just a hunch at 
this point, it sure looks like something that goes wrong "down in the depths" 
and it does nothing rather than reporting an error.  My question should have been clear 
(Guillermo obviously got it): does anyone else consider that combination of behaviors to 
be a problem?  Silent failures are the order of the day in Squeak; I hope we will 
eliminate them in Pharo.

So you think that you've found a bug in FFI, but instead of sharing more information about the problem or reporting the bug to the developers, you're blaming FFI and Squeak. There are lots of FFI users who pass Strings to functions which expect char*, and works for them. So, I'm pretty sure that if it's really a bug, then it's specific to the library/VM combination you're trying to use.


Levente


Yes, I can package and release the code.  Whether that will take the form of a 
quick example of what I suspect is a long-standing defect in FFI or a nice 
wrapper around PLplot will depend on how PLplot performs.

Windows device contexts are proving difficult to replace.  Otherwise, Microsoft 
can keep the OS.

Bill





________________________________________
From: [email protected] 
[[email protected]] On Behalf Of Levente Uzonyi 
[[email protected]]
Sent: Wednesday, September 15, 2010 10:01 PM
To: [email protected]
Subject: Re: [Pharo-project] Another silent failure?

On Wed, 15 Sep 2010, Schwab,Wilhelm K wrote:

I am interested in the opinions of helpful people who might have something 
constructive to add.

Sorry, but don't expect any help with this attitude. Even the most helpful
people - like Henrik - can't help you, because you don't give enough
information about your problem.

Which platform do you use?
Which VM/image do you use?
What's the library you'd like to use?
Is #cPlgver: an FFI call or do you use Alien? Maybe something else?
What's the type of the argument it expects?
If it calls a library function, does it store the pointer you're passing
to it?
Can you share your code?


Levente




________________________________________
From: [email protected] 
[[email protected]] On Behalf Of Henrik Johansen 
[[email protected]]
Sent: Wednesday, September 15, 2010 6:18 PM
To: [email protected]
Subject: Re: [Pharo-project] Another silent failure?

How do you expect us to help you debug this?
Really?

Cheers,
Henry

On Sep 15, 2010, at 8:45 38PM, Schwab,Wilhelm K wrote:

I am playing with a new library and for kicks thought I would call its 
get-version function:

| buffer |
buffer := String new:80.
PLplotLibrary default cPlgver:buffer.
buffer.

The above appears to do nothing; the buffer remains blank, and there is no 
error raised from it.  I tried something more complicated involving external 
address and #alloc: and got the version number.  That is encouraging from a 
perspective of talking to the library, but then I had to square the above 
failure with my use of memcpy() not long ago (different topic).  In that case, 
I had real need to allocate a buffer in a fixed heap, but was told that I could 
ultimately copy from said buffer (which lives across multiple gcs and would 
move) into a ByteArray of the needed size, which would not move during the 
memcpy() call.  That worked.  So I tried

| buffer |
buffer := ByteArray new:80.
PLplotLibrary default cPlgver:buffer.
buffer asString.

and get the version number.  What's up?  Why is it ok to pass a byte array but 
not a string?  If there really is a difference, there should be an exception 
hinting that something is wrong and what it might be - right?

Bill



_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to