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

Reply via email to