On Wed, Sep 15, 2010 at 3:45 PM, Schwab,Wilhelm K
<bschwab@anest.ufl.edu> 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?
I was taught that when objects can't answer a message the right way, they should raise an exception :).
BTW, I don't know the difference between ByteArray and String... so I have to do some research :)
�
Bill
_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project