Unmanaged DLL .NET Access to XML read/write routines

D

Dave Griffin

This is a followup to my question in doing unmanaged DLLs in .NET. I
was able to create the DLL and the application was able to see it. So
far so good. Now I need to make that unmanaged DLL read an XML file
which contains a scenario I plan to follow within the library.

Basically this DLL is an interface to a 1553 network with data being
sent and received. By creating an artificial version, I hope to
pretend to send and receive a huge amount of data to stress my
software. But to do this, I need to execute a "scenario" of timed
events. To do that, it seems natural to use the .NET XML processing
code. Trouble is I can't get it to work. I can't even get the Console
writelines to work. Maybe as an unmanaged DLL I can't get to those
functions or maybe I'm just not doing it right.

In this unmanaged DLL, in C++ should I be able to do the following:
#using <mscorlib.dll>
#using <System.Xml.Dll>

using namespace System;
using namespace System::IO;
Console::WriteLine (S"File {0} read sucessfully ...",
args);
 
W

Willy Denoyette [MVP]

Not sure what you are trying to achieve, this code:
- must be compiled as managed C++
- fails to compile.

Willy.
 
D

David Griffin

Well, my application is built on the foundation of this unmanaged DLL
written
by another company (who won't write a true .NET assembly). I want to
test my
application on a computer which doesn't have the hardware to support the
real library. My thought is to create another version of the library
that looks
identical to that other company's unmanaged DLL to my own application.
If
within that phony version of their library I can pretend to receive
network
traffic and return it as the real library would, then I can exercise my
application even though the computer it's running on doesn't have the
hardware to really run.

So the problem is that the DLL I create has to be unmanaged in order to
be
called like the unmanaged DLL I'm replacing is called, and yet I want to
use
sophisticated services like console writes and XML reads. Perhaps I
should be
just trying to just use standard C writes and file reads (if that
works). The
goal is to feed my C# .NET application data through this unmanaged DLL
interface so that it looks like it's connected to the original unmanaged
DLL
and through it, the network of data.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top