I am using the visual studio express 2005's setting of "register com
interop". does the proper job of registering my Classslib as useable by
native(unmanaged) com consumer?
Can any one confirm one way or another?
using the com interface from unmanaged application, I don't have any problem
calling functions returning only primitive data types and even strings.
However I am having problem using the assembly from the same native
application through
com interface when there is string array involved. In the vb project I did
"enable com interop". and use the class library template.
the desired call signature by COM consumer is something like this
integer li_rc, li_sz
string ls_out[]
string ls_in
li_rc = myfcn(ls_in , ls_out, li_sz) / li_sz is to contain the number of
the elements in ls_out
// only ls_in is to pass by vale, the rest by reference
Vb classlib has something like this
Function myfcn( ByVal sIn As String, _
<Out()> <MarshalAs(UnmanagedType.LPArray,
ArraySubType:=UnmanagedType.LPStr, SizeParamIndex:=1)> ByRef sOut As
String(),_
<Out()> ByRef iCnt As Integer) As Integer
sOut = Split(sIn, vbTab)
icnt = sOut.GetUpperBound(0) + 1
End Function
Dmytro Lapshyn [MVP] - 23 May 2006 08:23 GMT
Hi,
>I am using the visual studio express 2005's setting of "register com
>interop". does the proper job of registering my Classslib as useable by
>native(unmanaged) com consumer?
It should. However, I am not sure this IDE setting *fully* registers your
assembly for COM interop. In VS 2003, I recall there were issues with the
lack of proper TLB registration and the code base when the "register com
interop" IDE setting was used.
You can consider adding pre- and post-build steps in which you would invoke
the regasm.exe command-line tool with all the proper arguments.
> However I am having problem using the assembly from the same native
> application through
> com interface when there is string array involved. In the vb project I
> did
> "enable com interop". and use the class library template.
Try this workaround:
http://technolog.nl/EProgrammer/archive/2005/11/24/402.aspx