Click here to Skip to main content
15,906,558 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
AnswerRe: How to get pixel value using WinForm Pin
Christian Graus17-Oct-06 7:22
protectorChristian Graus17-Oct-06 7:22 
GeneralRe: How to get pixel value using WinForm Pin
uusheikh17-Oct-06 23:03
uusheikh17-Oct-06 23:03 
GeneralRe: How to get pixel value using WinForm Pin
uusheikh17-Oct-06 23:06
uusheikh17-Oct-06 23:06 
QuestionRUNGE-KUTTA ALGORITH FOR SECOND-ORDER ODE Pin
sahoong15-Oct-06 6:57
sahoong15-Oct-06 6:57 
AnswerRe: RUNGE-KUTTA ALGORITH FOR SECOND-ORDER ODE Pin
Christian Graus17-Oct-06 7:23
protectorChristian Graus17-Oct-06 7:23 
GeneralRe: RUNGE-KUTTA ALGORITH FOR SECOND-ORDER ODE Pin
sahoong18-Oct-06 3:47
sahoong18-Oct-06 3:47 
QuestionWinodws Media Player Visualization Pin
ceejeeb14-Oct-06 6:37
ceejeeb14-Oct-06 6:37 
QuestionC++/CLI managed code calling incorrect methods on unmanaged C++ classes Pin
dhazen13-Oct-06 5:20
dhazen13-Oct-06 5:20 
Hi,

I posted this on MS's "Visual C++ Language" forum a few days ago without getting a useful answer. I'm hoping somebody (Nish??) here can help. I'm pretty desperately needing a solution at this point.

We are doing a transition project where we are wrapping unmanaged C++ code with C++/CLI (VS 2005) managed classes. The various methods and properties on a given managed wrapper class are mostly just pass-through calls to the wrapped C++ class.

Mostly this works fine. Sometimes, however, the call from the managed code ends up in the wrong C++ function. IOW:

void ManagedMethod1( void )
{
m_pUnmanagedObject->Func1();
}

actually calls m_pUnmanagedObject->Func20().

So far, it seems that every time this happens, the called method on the UNmanaged C++ class is declared "virtual"; it also seems that the incorrect method that is actually called is also declared virtual. I have tried in one or two situations to change the legacy class method to non-virtual and it fixed the problem. However, that isn't a very general or useful solution.

The unmanaged code is in a DLL, and the managed wrappers are in an assembly DLL. I've cleaned and rebuilt both multiple times, as well as the C# test driver program.

There is another problem that is probably related that I've found with another virtual function, this one taking a parameter (the first problems above were with virtual functions taking no parameters). Tracing in the managed wrapper code in Disassembly mode, there is what looks like a call to something called MarshalCopy, which calls the copy c'tor for the class of the passed parameter. This call appears to execute without error; however, when execution returns from that function, it returns to a completely different place than it was called from, which needless to say, is fatal pretty quickly.

I'm sure I'm doing something wrong and/or stupid; perhaps I need some kind of explicit marshalling (though I thought you didn't need this with C++ interop), or some compiler switch or something. But I've looked and looked, and can't find anything.

I would GREATLY appreciate any help or suggestions.

Thanks.

Doug

AnswerRe: C++/CLI managed code calling incorrect methods on unmanaged C++ classes Pin
dhazen25-Oct-06 10:13
dhazen25-Oct-06 10:13 
Questionproblem with converting CString to int Pin
singersinger11-Oct-06 1:33
singersinger11-Oct-06 1:33 
AnswerRe: problem with converting CString to int [modified] Pin
Epi11-Oct-06 2:36
Epi11-Oct-06 2:36 
AnswerRe: problem with converting CString to int Pin
led mike11-Oct-06 4:43
led mike11-Oct-06 4:43 
AnswerRe: problem with converting CString to int Pin
tydok18-Oct-06 4:02
tydok18-Oct-06 4:02 
QuestionFrom CString to String^ Pin
Epi11-Oct-06 0:41
Epi11-Oct-06 0:41 
AnswerRe: From CString to String^ Pin
Nish Nishant11-Oct-06 4:08
sitebuilderNish Nishant11-Oct-06 4:08 
Questiontreeview with windows forms Pin
Epi10-Oct-06 2:12
Epi10-Oct-06 2:12 
AnswerRe: treeview with windows forms Pin
jhwurmbach10-Oct-06 2:35
jhwurmbach10-Oct-06 2:35 
GeneralRe: treeview with windows forms Pin
Epi10-Oct-06 3:27
Epi10-Oct-06 3:27 
QuestionInvoke a method on a windows form object Pin
bankai1239-Oct-06 21:08
bankai1239-Oct-06 21:08 
QuestionAvoiding "using namespace" Pin
zaccheus9-Oct-06 13:31
zaccheus9-Oct-06 13:31 
AnswerRe: Avoiding "using namespace" Pin
Michael Dunn9-Oct-06 15:13
sitebuilderMichael Dunn9-Oct-06 15:13 
GeneralRe: Avoiding "using namespace" Pin
George L. Jackson9-Oct-06 23:36
George L. Jackson9-Oct-06 23:36 
GeneralRe: Avoiding "using namespace" Pin
zaccheus10-Oct-06 7:59
zaccheus10-Oct-06 7:59 
GeneralRe: Avoiding "using namespace" Pin
Nish Nishant10-Oct-06 9:53
sitebuilderNish Nishant10-Oct-06 9:53 
GeneralRe: Avoiding "using namespace" Pin
zaccheus10-Oct-06 13:10
zaccheus10-Oct-06 13:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.