(I'm not sure I can really help, but I know that there's a lot of info that
others who could help would want to have.)
Do you have any methods in your "c# com class" that work when called from your
"legacy c"? Have you compiled the c# code so that a CCW is created? How are
you accessing the resulting COM class from your "legacy c" code?
How is "string" defined in your "legacy c" code? There's no standard string
type in "legacy c". (Is it really "legacy c" or is it MS Visual C++ code? Are
you using VS03 / VS05 / other to develop the legacy code?)
Are you trying to get back an array of strings, where the number of strings
returned is unknown to the legacy caller and is determined by the c# code
that's being called? (That's what you seem to be doing.) If so, what is
supposed to be allocating memory on the legacy side to hold the (pointers to
the) individual strings?
When you say "but none worked" what do you mean? That the c# code would not
compile? That the legacy app crashed when you tried the call?
More details of any legacy code that makes successful calls to the C# code
might help. Good luck!
At 01:58 AM 5/17/2006, G G wrote
>I am having trouble making a function of my c# com class callable by legacy
>application.
>
>The desired unmanaged signautre for calling gthe function is
>int32 lsz;
>string str_result[]
>
>// setup the oleobj to connect to the com calls...
> lsz = oleobj.strArrayfcn(str_result)
> // or similar
>
>
>After reading the msdn articles ( my mind is still clear as mud)
>I tried in c#
>public int strArrayfcn( out string[] str_result)) {
>...
>}
>
>
>public int strArrayfcn(out int iSize, out string[] str_result))
>{
>...
>}
>
>public integer strArrayfcn[Out()] [MarshalAs(UnmanagedType.LPArray,
> ArraySubType=UnmanagedType.LPStr, SizeParamIndex=1)] out string[] str_ar,
> int iSz )
>{
>...
>}
>
>
>public integer strArrayfcn[Out()] [int iSz,
> MarshalAs(UnmanagedType.LPArray,
> ArraySubType=UnmanagedType.LPStr, SizeParamIndex=0)] out string[] str_ar )
>
>{
>...
>}
>
>
>but none worked. what should I do
J. Merrill / Analytical Software Corp
===================================
This list is hosted by DevelopMentorĀ® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com