DLL & C Connect - How to cast to structure

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

DLL & C Connect - How to cast to structure

Dmytryk, Igor
DLL & C Connect - How to cast to structure

Can someone tell me how to cast a pointer to structure in VW? 
For example...in c code a function call casts a pointer to character array to a pointer to a structure:

char *charArray;
struct someStruct
        {
        int num;
        int secondNum;
        };


someFunction(someStruct *pointerToStruct)
{
.....
}

in the code the function gets called with the pointer to the character array is cast to a pointer to a structure:

someFunction((someStruct *)charArray);

How can I do this in VW?


Thanks

       

Reply | Threaded
Open this post in threaded view
|

DLL & C Connect - How to cast to structure

Eliot Miranda-2
aCCompositeType pointerType coerce: aCPointer

e.g.

CCompositeType allInstances collect:
    [:cct| cct pointerType coerce: (CPointer new referentAddress: 12345)]
=>
    #(a CCompositePointer {00003039} (struct ACL * )
      a CCompositePointer {00003039} (struct RECT * )
      a CCompositePointer {00003039} (struct SECURITY_ATTRIBUTES * )
      a CCompositePointer {00003039} (struct {
    long cx, cy;
} * )

etc...


On 2/9/07, Dmytryk, Igor <[hidden email]> wrote:

Can someone tell me how to cast a pointer to structure in VW? 
For example...in c code a function call casts a pointer to character array to a pointer to a structure:

char *charArray;
struct someStruct
        {
        int num;
        int secondNum;
        };


someFunction(someStruct *pointerToStruct)
{
.....
}

in the code the function gets called with the pointer to the character array is cast to a pointer to a structure:

someFunction((someStruct *)charArray);

How can I do this in VW?


Thanks