Function written in Delphi2010 COM object not visible in C# .net
I wrote a function in Delphi 2010 COM object. This function will return string using PChar. I tried to use the COM object in C# .net. So, i added the reference to the COM DLL in my C#. NET application.
I found out that the function is not visible in the References explorer list, whereas the other functions which i wrote earlier are available.
I could not figure out the reason for this strange issue. I unregistered and registered the COM object again but still same issue contd?
We faced some issues ea开发者_C百科rlier in using String type. So, we tried pchar.
Sample code in Delphi 2010
function TILCalculation.TestString(out Rslt: PChar): WordBool; Var sRes : String ; begin sRes := 'This is my Test data!!!'; StrPCopy(Rslt,sRes); end;
I tried the following in C# .net Selected References Under WindowsFormApplication Selected Add references and choosen COM tab Selected the COM object.
I noticed that my COM object is visible in the object browser. So, i expanded the object and checked. Alas!!! This function is not visible in C# .net references. All the functions created earlier are visible
Any help would be very much appreciated
Tks in adv Ven
PChar is not a normal type in COM. Have you tried using WideString instead?
PS: See Rob's suggestion to include some code examples for a better answer.
精彩评论