views:

1057

answers:

1

Using VB.NET, is there a way to pass a reference argument when invoking a function in a dll.

Suppose I want to pass arg2 as a reference argument, how would I do that?


method.Invoke(obj, New [Object]() {arg1, arg2, arg3})

In other words I want to point arg2 to something else within the invoked function.

+1  A: 

If the target function defined as ByRef it'll work automagically otherwise AFAIK you can't.

Call it like :

method.invoke(obj, arg1, arg2, arg3)

In your case you actually sending one parameter (an object array)

dr. evil
Yes, the target function argument is defined byref, but it does not work.
Yup, that's how I'm calling it.
just updated, can you try this?
dr. evil
OIC, what you're saying. I don't believe there is an overload for that type of call.
yeah ParamArrays are quite useful stuff. So you can send parameters as much as you want to a function.
dr. evil