> Dim lDummy as New XClassDerived
> XXX(CType(lDummy, XClassDerived))
>
> I assume that the Class stores some additional data that confuses
> the interface to teh X.dll?
No. A structure is a value type. A class is a reference type. Using ByRef,
the reference to the passed value is passed. Using ByVal.... wait...
http://groups.google.com/group/microsoft.public.dotnet.languages.vb/msg/41e83beb
9988aabf
> Is there any way to make this work???
Change it to ByVal: (ByVal XArgument As XClassBase)
Armin
Joe HM - 30 Oct 2007 14:18 GMT
Hello -
Thanks for the information! Using ByVal will not make it abort
anymore but the function in the X.dll that is called modifies the
fields of the data passed in. So I need to use ByRef to get to the
modified values.
Is there any way to make this work with ByRef?
Thanks,
Joe
> > Dim lDummy as New XClassDerived
> > XXX(CType(lDummy, XClassDerived))
[quoted text clipped - 12 lines]
>
> Armin
Terry - 30 Oct 2007 14:48 GMT
Passing a reference type byval does allow the function to change the passed
type. ByVal of a reference type, passes the reference, allowing the routine
to change the object that the reference points to. ByRef of a reference
type, passes a reference to the reference, allowing the routine to change the
reference!

Signature
Terry
> Hello -
>
[quoted text clipped - 24 lines]
> >
> > Armin
Joe HM - 30 Oct 2007 15:10 GMT
Yep ... that was my point. I need this to work with ByRef ... any
ideas?
Thanks!
Joe
> Passing a reference type byval does allow the function to change the passed
> type. ByVal of a reference type, passes the reference, allowing the routine
[quoted text clipped - 34 lines]
>
> - Show quoted text -
Rory Becker - 30 Oct 2007 15:33 GMT
> Yep ... that was my point. I need this to work with ByRef ... any
> ideas?
I *think* Terry was trying to say that you can change your declaration to
ByVal and you will still be able to change the fields of the param in question.
ByVal only prevents you from assigning a new object to the param.
--
Rory
Terry - 30 Oct 2007 15:51 GMT
you had said ..."but the function in the X.dll that is called modifies the
fields of the data passed in"
And I am saying, passing a reference type byval DOES allow that. When
passing a reference type byval, a copy of the REFERENCE (not the object the
reference points to) is passed to the function so that there are now 2
references to the SAME object.
Now having said all that, I am not familiar with Ada, so I don't know if
that presents any additional complications.

Signature
Terry
> Yep ... that was my point. I need this to work with ByRef ... any
> ideas?
[quoted text clipped - 40 lines]
> >
> > - Show quoted text -
Joe HM - 30 Oct 2007 17:33 GMT
Hello -
Sorry guys ... I guess I did not pay attention when I read this. I
remember the concept of passing in a copy of the reference from C++.
I did not create the *.dll but I can talk to the person who did to see
whether this can be done in Ada.
Thanks!
Joe
> you had said ..."but the function in the X.dll that is called modifies the
> fields of the data passed in"
[quoted text clipped - 53 lines]
>
> - Show quoted text -
Jack Jackson - 30 Oct 2007 18:07 GMT
No you don't need ByRef. In either case the called routine can modify
the contents of the class or structure.
With ByRef the called routine can allocate a new instance of the class
and change the reference in the caller. With ByVal the caller's
reference can't change.
>Hello -
>
[quoted text clipped - 24 lines]
>>
>> Armin