On 15/8/06 18:48, "Jonathan Johnson" <[EMAIL PROTECTED]> wrote:

> 
> On Aug 15, 2006, at 12:46 PM, Mars Saxman wrote:
> 
>> 
>> On Aug 15, 2006, at 10:33 AM, Daniel Stenning wrote:
>> 
>>> But I specifically need to pass the pointer of my structure to an
>>> external
>>> DLL  function which takes a pointer to a structure. Is there no way
>>> to do
>>> this?
>> 
>> Yes: declare the parameter ByRef.

So I can do this ?:

 Declare Sub myDLLcall Lib "mylibrarypath"  (pStruct as Ptr)

 or maybe: 

  Declare Sub myDLLcall Lib "mylibrarypath"  ( ByRef pStruct as myStructure)

And then can I do this ??

Sub myRBmethod( ByRef rStruct as myStructure )
    call myDLLcall( rStruct )
End Sub

And then in my main code do this ?:

Dim mystruc as myStructure
Call myRBmethod( mystruc )

?

Although memoryblocks are great,  I think its a pain that we have to keep
converting to and fro memoryblocks all the time, when really we are dealing
with structures  ( and their pointers )
>> 
>>> Also - how can I convert a pointer to a structure obtained from a
>>> Dylib call
>>> into an RB structure reference ?
>> 
>> You can't do that directly, but you can dereference the pointer:
>> 
>> Dim foo As Ptr, bar As someStructure
>> bar = foo.someStructure

that's fine if we want a copy of the structure values, but not if we need to
keep playing with the original structure  "in place"

> 
> Disregard my previous suggestion: this is much easier and better :)
> 
> -Jon
> 


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

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to