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

Managed C++/CLI

 
GeneralRe: SerialComm Pin
User 91483318-Apr-04 13:12
User 91483318-Apr-04 13:12 
GeneralChange Text (Caption) Color for a MFC Button Pin
HaHa!30-Mar-04 4:54
HaHa!30-Mar-04 4:54 
GeneralRe: Change Text (Caption) Color for a MFC Button Pin
Renjith Ramachandran7-Apr-04 21:14
Renjith Ramachandran7-Apr-04 21:14 
Generalnewbie question Pin
charlener29-Mar-04 7:23
charlener29-Mar-04 7:23 
GeneralRe: newbie question Pin
zena992-Apr-04 8:24
zena992-Apr-04 8:24 
Generalusing iterator to count though vector Pin
wadstar29-Mar-04 6:25
wadstar29-Mar-04 6:25 
Generalunmanaged class declaring managed member function as friend Pin
godzooky29-Mar-04 4:15
godzooky29-Mar-04 4:15 
GeneralRe: unmanaged class declaring managed member function as friend Pin
Andy Wieberneit30-Mar-04 0:21
Andy Wieberneit30-Mar-04 0:21 
I don't think you really need that friend directive. Most probably, you could simply make your classes public and avoid inline methods.

It seems that you want to call a managed method from an unmanaged class. However, this can't be done by a direct call, because managed objects are subject to garbage collection. To get a safe entry point into the managed heap, you have to use a GCHandle, which in turn is wrapped by the gcroot template. Try this:

#include <vcclr.h>
class ManagedClass;
class UnmanagedClass
{
public:
    UnmanagedClass( ManagedClass* p );
private:
    gcroot< ManagedClass* > m_pManaged;
}

You can then make your calls into the managed class with the m_pManaged pointer.

There might be another problem: Since you have both managed and unmanaged code in one project, this project needs to be linked in mixed mode. This is because for the unmanaged code, you need the C runtime, which requires an entry point as well as statics. For an instruction of how to convert your project to mixed mode, see the article: "Converting Managed Extensions for C++ Projects from Pure Intermediate Language to Mixed Mode" in the MSDN.
GeneralName Mangling Pin
Member 62566625-Mar-04 5:41
Member 62566625-Mar-04 5:41 
GeneralRe: Name Mangling Pin
Nemanja Trifunovic25-Mar-04 5:49
Nemanja Trifunovic25-Mar-04 5:49 
GeneralRe: Name Mangling Pin
Member 62566625-Mar-04 5:54
Member 62566625-Mar-04 5:54 
GeneralRe: Name Mangling Pin
Rick York25-Mar-04 6:09
mveRick York25-Mar-04 6:09 
GeneralRe: Name Mangling Pin
Member 62566625-Mar-04 7:43
Member 62566625-Mar-04 7:43 
GeneralRe: Name Mangling Pin
Member 62566625-Mar-04 10:20
Member 62566625-Mar-04 10:20 
GeneralRe: Name Mangling Pin
Rahul20067611-Apr-04 4:04
Rahul20067611-Apr-04 4:04 
GeneralProblems with lib file and linking Pin
ravjak24-Mar-04 9:20
ravjak24-Mar-04 9:20 
GeneralRe: Problems with lib file and linking Pin
ian mariano24-Mar-04 17:19
ian mariano24-Mar-04 17:19 
GeneralRe: Problems with lib file and linking Pin
ravjak25-Mar-04 5:17
ravjak25-Mar-04 5:17 
GeneralRe: Problems with lib file and linking Pin
ravjak25-Mar-04 5:22
ravjak25-Mar-04 5:22 
GeneralRe: Problems with lib file and linking Pin
ravjak28-Mar-04 2:42
ravjak28-Mar-04 2:42 
GeneralMixing C++ and C Pin
Member 62566623-Mar-04 8:01
Member 62566623-Mar-04 8:01 
GeneralRe: Mixing C++ and C Pin
ian mariano23-Mar-04 10:17
ian mariano23-Mar-04 10:17 
GeneralRe: Mixing C++ and C Pin
Member 62566623-Mar-04 10:28
Member 62566623-Mar-04 10:28 
GeneralRe: Mixing C++ and C Pin
ian mariano24-Mar-04 2:01
ian mariano24-Mar-04 2:01 
GeneralRe: Mixing C++ and C Pin
Member 62566625-Mar-04 5:15
Member 62566625-Mar-04 5:15 

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.