-
October 11th, 2010, 08:10 AM
#1
Calling C++/CLI method from C#
Hi
I have ported some old BC++ code to Managed C++/CLI code and build it to a dll
Now I trie to call a method from this dll in my C# code. But this does not work. The compiler gives the following error:
'TProjLicense' does not contain a definition for 'CalcSignature' and no extension method 'CalcSignature' accepting a first argument of type 'TProjLicense' could be found (are you missing a using directive or an assembly reference?)
The code (C++/CLI) in my DLL is as follows:
public class TProjLicense
{
public:
// Constructor
TProjLicense() {};
String ^ TProjLicense::CalcSignature(String ^ CustName, array<String ^> ^Proj,
int NumProj);
};
And from C# I am calling it as follows:
// Make a list of all project names
String [] ProjectList = new String [10];
//ProjectList[1] = cmbProject1->Items->Strings[cmbProject1.SelectedIndex];
ProjectList[0] = cmbProject1.SelectedText;
ProjectList[1] = cmbProject2.SelectedText;
.....
// Generate the signature;
TProjLicense License;
edtSignature.Text = License.CalcSignature(edtCustomerName.Text,
ProjectList, 10);
Probably there is something with the string array, but I am new in CLI/C# so I don't have a clue how to solve this.
Has anyone an idea ?
Thanks already.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|