I am just trying C# express 2005 ( beta 2) from a limited XP pro user account. I setup a C# assembly as COM component for interop with some legacy application that can use either COM interface or the traditiona Native DLL interface. I ran into some rather unspecified errrors. I suspect its either the name space that I got wrong or something with my code or project setup.
what did I miss in the following
project info
Project name SomeClass
Output type: Class Library
Assembly info:
COM Visible
GUID generated by the studio express
default namespace SomeClass
The source code I tried:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace SomeClass
{
public class ArrayClass
{
public int testInt()
{
return 6999;
}
public int ReturnStringArray(String sIn, out String[] newStrs)
{
newStrs = sIn.Split(' ');
return newStrs.Length;
}
}
My unmanaged native client ( some C++ Built application thant can conume use OLE , COM...)
OleObject objClass
objClass = create OleObject
int rc
rc = objClass.connectToNewObject("SomeClass.ArrayClass")
// fails here with return code -2 - cannot create class ( i used vbscript to check this part out
/*
I tried to use the GUID string, "SomeClass.SomeClass.ArrayClass")
but none worked
*/
long lSz
String lstrOut[]
Integer i
lSz = -9
mle_1.text = "~r~ncalling testInt()~r~n"
lSz = objClass.testInt()
mle_1.text += " returned long value of " +string(lSz)+ " ~r~n"
lSz = -9
mle_1.text += "~r~ncalling testscalar ~r~n"
String lstrtst
lSz = objClass.testscalar(sle_in.text, Ref lstrtst);
mle_1.text += " returned lSz=" +string(lSz) +" StrOut=" + lstrtst + "~r~n~r~n"
I also tried without namespace in c#:
public class ArrayClass
{
public int testInt()
{
return 6999;
}
public int ReturnStringArray(String sIn, out String[] newStrs)
{
newStrs = sIn.Split(' ');
return newStrs.Length;
}
}
Or should I use the it just work approach for DLL ( I don't really understand what to do there either )

what did I miss in com interop?
Stanley35