saish,
The XmlDocument in .NET and the implementation of the IXMLDOMDocument is
not the same. You can not interchange the two.
First, you should expose the IXMLDOMDocument interface, not the
IXMLDOMDocumentPtr. I believe IXMLDOMDocumentPtr is a wrapper that is
generated for you which helps with the management of the instance.
Then, you have to set a reference to MSXML.dll in your .NET project, and
use the XML classes from there in order to pass to your dll.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"saish" <sa***@eircom.net> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
Hi Nicholas,
Thanks for your reply ..sorry for not being clear ..
details below ..
I have a C++ win 32 dll which as below code. It has two function one
which takes integer by reference and one with xmldocument by reference.
These dll functiona are called successfully by a C++ executables.
----------------
extern "C"
{
extern int WINAPI fnTestXml(MSXML2::IXMLDOMDocumentPtr pXmlDoc);
extern int WINAPI fnTestInt(int* i);
}
int WINAPI fnTestXml(MSXML2::IXMLDOMDocumentPtr pXml)
{
printf("fnTestXmlIn.pXml.xml=\n%s\n", (LPCSTR)pXml->xml);
pXml->loadXML("<root><adddednode>By the dll</ adddednode ></root>");
printf("fnTestXmlIn.pXml.xml=\n%s\n", (LPCSTR)pXml->xml);
return 99;
}
int WINAPI fnTestInt(int & px)
{
px = px + 10;
return 122;
}
LIBRARY xmlref
EXPORTS
FUNC_XML = fnTestXml
FUNC_INT = fnTestInt
-------------------
I have a requirement where one of our web services which recevies
xmldocument written either in vb.net or csharp has to call these dll
functions and pass these xmldocument.
csharp test code
----------------------
[DllImport("xmlref.dll")]
public static extern int FUNC_XML(ref XmlDocument pdoc);
...
XmlDocument xmlin = new XmlDocument();
xmlin.LoadXml("<test> how r u </test>");
FUNC_XML(ref xmlin); <----- It fails here ..
---------
The above dll code is a test code. the actual dll is one of calculation
dll engines which takes xmldocument by reference. This dll is called by
many application. One of my requirement was to call this dll from a
.net web service.
Thanks