On Apr 14, 2007, at 2:24 PM, Tim Jones wrote:

> On Apr 14, 2007, at 10:39 AM, Norman Palardy wrote:
>
>> On 14-Apr-07, at 11:19 AM, Tim Jones wrote:
>>
>>> Any pointers on how to pass a 2 member, modifiable array in this
>>> mode?
>>
>> A memory block
>
> Aha - writes on dri-erase board 100 times:
>
>       "I will learn to use memoryblocks"
>
> So that code becomes:
>
>       Dim thePipe As New MemoryBlock(8) // 2 Integers
>       Dim theErr As Integer
>
>       Soft Declare Function pipe Lib "LibC" (ByRef fd As Ptr) As Integer
>
>       theError = pipe(thePipe)
>
> This looks good, but now I'm getting "Function Not Found" when I call
> pipe during the compile.  So, it looks like Linux doesn't like the
> "LibC" library assignment.  When I use "/lib/libc.so.6", the code
> compiles and executes properly.
>
> Anyone experiencing declare issues on Linux?  Is this a bug (the LibC
> soft declare), or am I missing something?


You're missing something.  Is there is a file called "libc"  
somewhere?  On my Ubuntu installation, the closest thing I can find  
is /usr/lib/libc.so, which is a loader script that refers to /lib/ 
libc.so.6.  I think I explain this sort of stuff in my book on  
declares on my web site.

Also, you don't want to declare the parameter as ByRef.  The C  
prototype of pipe is the following.

int pipe (int filedes[2])

A C array is a nothing more than a block of memory, and an array  
variable is essentially a pointer to that block.  So you want to  
create a MemoryBlock of size 8 = 2*sizeOf(int), and pass a pointer to  
it to pipe.  Thus you declare the parameter in REALbasic to be of  
type Ptr.  Declaring it as ByRef should mean that you're passing a  
pointer to the address of the MemoryBlock.


Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to