|
-
April 1st, 2011, 07:25 AM
#1
Problem implementing an interface
Hello all,
I am trying to port over some code from C# to C++ and am having a problem with one of the functions in one of the interfaces.
The original function in the interface in C# is:
void GetApplicationThreadCount(String applicationId, out Int32 totalthreads, out Int32 unfinishedThreads);
and the C# implementation:
public void GetApplicationThreadCount(String applicationId, out IntPtr totalThreads, out IntPtr unfinishedThreads)
after reading for a while about the out keyword, I thought I should convert the interface to this:
virtual void GetApplicationThreadCount(String^ applicationId, [System::Runtime::InteropServices::Out] %totalthreads, [System::Runtime::InteropServices::Out] %unfinishedThreads);
and the c++ implementation to this:
void GetApplicationThreadCount(String^ applicationId, [System::Runtime::InteropServices::Out] %totalThreads, [System::Runtime::InteropServices::Out] %unfinishedThreads)
now I put all this together in a mixed project(the code I have converted along side the original code) so I could debug as I was wtiting it, and the C++ version appeared to work when called from C#, however, I am now converting that calling code to C++ and it does not work anymore.
The calling code from C# is:
GetApplicationThreadCount(application.ApplicationId, out totalThreads, out unfinishedThreads);
and the calling code in C++:
GetApplicationThreadCount(application->ApplicationId, totalThreads, unfinishedThreads);
totalThreads and unfinishedThreads are of type IntPtr, but when I try this, the compiler keeps telling me that I havent implemented this function yet, Im not sure but think something must be wrong in the implementation,but I am at a loss as to how to fix it.
I need the code to be callable from both C# and C++.
Thanks in advance,
Richard
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
|