Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COM DLL WITH .NET ON WIN2003 SERVER

Status
Not open for further replies.

suheil

Programmer
Dec 15, 2005
3
US
I have a VFP8 project that I compiled into a Multithreaded COM server DLL. I am then adding this DLL as a Reference in a C#.NET project, and calling a function from it. This has been working as expected on WinXP and Win2000. Recently, I tried it on Windows 2003 Server, and the call to the function in COM dll fails. I get the error message: "Object reference not set to an instance of an object." I'm not sure if this is a VFP issue or a .NET issue, but thought perhaps someone else here has run into this, and has some suggestions.

I can't think of any security or firewall issues, as this is all running on the same machine. And I'm pretty sure I have all the files needed, because when I transfer the same files to an XP or W2k machine, it works. The DLL also registered successfully on the Windows 2003 Server.

Here is my VFP code:

Code:
DEFINE CLASS SysWrapper as session olepublic 
	FUNCTION TEST
		return "abc"
	ENDFUNC  
ENDDEFINE

On the .NET side, the code is simple, too:

Code:
	using myDll;

	myDll.SysWrapperClass myObj = new myDll.SysWrapperClass();
	string s = (string) myObj.TEST();
	Console.WriteLine(s);

Many thanks,
-sl

 
Not really sure to be honest. Looks good. Is the com object registered properly on the server?

What if you unregister it, the re-register it:

Code:
regsvr32.exe /u "pathtofile/mydll.dll"

then

Code:
regsvr32.exe "pathtofile/mydll.dll"

Ron Wheeler
Tekdev Open Source Development
 
I see that you're test app is a console application. Have you test the COM output if it really does works? I don't how how VFP builds a COM, but try writing a small script (eg. Vbs) and instantiate the SysWrapper using CreateObject().
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top