I would be grateful if you could help me with my problem.
I have created a dll using C++ .net 2003 which contents a class of methods.
Furthermore, i have created a gui application using microsoft visual C# 2008 exrpess edition.
I would like to use two class methods of the dll described before.
Therefore i have developed the following code in C# ( it takes an input string and returns void as output)
[DllImport("retrieval.dll"
, EntryPoint = "initialize")]
[return: MarshalAs(UnmanagedType.BS
tr)]
public static extern void initialize([MarshalAs(Unma
nagedType.
BStr)] string xml);
The code above responds to c++ dll as
void SIMPLE_RETRIEVAL::initiali
ze(const char *param_xml)
In addition, i have developed a second method (it takes a string as input and returns an array of longs)
The C# code that will respond to C++ dll method is
long* SIMPLE_RETRIEVAL::parse_qu
ery_and_re
trieve(con
st char *image)
However i didn't managed to call this method above from C#....
How i could do this ?
Furthermore, when i call the first method
private string xml = "C:\retrieval_parameters.x
ml";
private void InitializeComponent()
{
this.initialize(this.xml);
....
....
}
from the C# code
I take the following error :
Member 'WindowsFormsApplication1.
Form2.init
ialize(str
ing)' cannot be accessed with an instance reference; qualify it with a type name instead
Since i am newbie i would really appreciate your assistance!
Furthermore would i have any problems in C# if the C++ dll that i ve created has other dll dependencies.
Thank you
Best Regards
Comadreja 82
Start Free Trial