what if a toolbox function needs a struct, which would be a memoryblock of a
certain size, and the struct itself has to have a pointer to a list of
unknown size? how big should the memoryblock for the function be in that
case?
First, what specific call and struct are involved? Posting those
details will help folks give you more specific advice.
As to sizes -- a pointer is just 4 bytes, so you just need a 4-byte
MemoryBlock for that. However, you say the struct is supposed to be
a pointer to a list. I would bet that you're crashing because you're
sending an uninitialized pointer to the toolbox call, but it's
expecting the pointer to already be pointing to a valid block of
memory into which it can read and/or write.
If this is the case, you need to create the pointed-to block. Try a
declare to NewPtr:
Declare Function NewPtr Lib "InterfaceLib" (byteCount as Integer) as Ptr
dim a as MemoryBlock
a = NewMemoryBlock(4)
a.Ptr(0) = NewPtr(90)
(Of course, you'll need to change that to "CarbonLib" under Carbon.)
if a service i am attempting to sign in to requires a callback function,
does this mean i have to create a class (datatype) in rb to respond to it?
Toolbox callbacks cannot be done in RB. The Toolbox is expecting a
nice, C routine, and RB methods don't fit the bill. To do anything
involving a callback, you'll need to write a plugin.
--
-Thomas
Personal web page: http://home.earthlink.net/~thomasareed/
My shareware: http://home.earthlink.net/~thomasareed/shareware/
REALbasic page: http://home.earthlink.net/~thomasareed/realbasic/
Pixel Pen web pub. guide: http://home.earthlink.net/~thomasareed/pixelpen/
How long a minute is depends on which side of the bathroom door you're on.
|