tacho_fortin
Guest
|
Posted:
Tue Jan 04, 2005 7:07 pm Post subject:
array of strings as parameter to COM |
|
|
Hi ppl,
Im trying to pass a list of strings as a parameter to a COM dll made in c#.
The problem i have is that although i can pass a single string, couldnt guess how to do it with an array.
Here is the code.
defun test ( / arr )
(vl-load-com)
(setq arr (vlax-make-safearray vlax-vbString '(0 . 1) ))
(vlax-safearray-fill arr '("test1" "test2"))
(vlax-invoke-method (vlax-invoke (vlax-get-acad-object) "getinterfaceobject" "ns.cls")"test" arr)
(princ)
)
using System.Runtime.InteropServices ;
namespace ns{
public class cls{
public void test(object a ){
string[] arrayOfStrings = (string[])a;
System.Diagnostics.Debug.Assert( false ) ;
}
}
}
With this code, i receive an int in the parameter "a" of the "test" function in c#.
I guess that may be a pointer, but kept me scratching my head for a lot of time how to marshal that to a usable array.
|
|