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

Managed C++/CLI

 
QuestionString pass by reference Pin
carlo.andreoli2-Oct-09 1:32
carlo.andreoli2-Oct-09 1:32 
AnswerRe: String pass by reference Pin
teejayem2-Oct-09 6:28
teejayem2-Oct-09 6:28 
GeneralRe: String pass by reference Pin
carlo.andreoli5-Oct-09 3:20
carlo.andreoli5-Oct-09 3:20 
QuestionDual Linkage Possible with Managed DLL? Pin
Richard Andrew x6430-Sep-09 14:13
professionalRichard Andrew x6430-Sep-09 14:13 
AnswerRe: Dual Linkage Possible with Managed DLL? Pin
Luc Pattyn30-Sep-09 14:30
sitebuilderLuc Pattyn30-Sep-09 14:30 
GeneralRe: Dual Linkage Possible with Managed DLL? Pin
Richard Andrew x6430-Sep-09 14:35
professionalRichard Andrew x6430-Sep-09 14:35 
GeneralRe: Dual Linkage Possible with Managed DLL? Pin
Luc Pattyn30-Sep-09 14:45
sitebuilderLuc Pattyn30-Sep-09 14:45 
AnswerRe: Dual Linkage Possible with Managed DLL? Pin
N a v a n e e t h30-Sep-09 18:19
N a v a n e e t h30-Sep-09 18:19 
This is possible using conditional compilation. You need to create managed and unmanaged methods in the header files separated with _MANAGED preprocessor symbol.

Consider the following code.
C++
//MixedAPI.h

#ifdef _MANAGED
   using System;
   using System::Runtime::InteropServices;
#endif

#include <string>

class MixedAPI
{
public:
#ifdef _MANAGED
    void TakeAString(gcroot<String^>); // Managed callers can see this
#else
    void TakeAString(std::string);  // Native users can only see this
#endif
};

//MixedAPI.cpp

void MixedAPI::TakeAString(gcroot<String^> str)
{
    // implementation
}

void MixedAPI::TakeAString(std::string str)
{
   // implementation
}
Smile | :)


GeneralRe: Dual Linkage Possible with Managed DLL? Pin
Richard Andrew x6430-Sep-09 18:22
professionalRichard Andrew x6430-Sep-09 18:22 
GeneralRe: Dual Linkage Possible with Managed DLL? Pin
N a v a n e e t h30-Sep-09 18:48
N a v a n e e t h30-Sep-09 18:48 
Questionusing unmanaged lib in managed class [modified] Pin
carlo.andreoli29-Sep-09 23:50
carlo.andreoli29-Sep-09 23:50 
QuestionRe: using unmanaged lib in managed class [modified] Pin
carlo.andreoli30-Sep-09 23:56
carlo.andreoli30-Sep-09 23:56 
AnswerRe: using unmanaged lib in managed class Pin
Richard MacCutchan1-Oct-09 0:40
mveRichard MacCutchan1-Oct-09 0:40 
GeneralRe: using unmanaged lib in managed class Pin
carlo.andreoli1-Oct-09 0:59
carlo.andreoli1-Oct-09 0:59 
GeneralRe: using unmanaged lib in managed class Pin
Richard MacCutchan1-Oct-09 1:56
mveRichard MacCutchan1-Oct-09 1:56 
GeneralRe: using unmanaged lib in managed class Pin
Richard MacCutchan1-Oct-09 2:38
mveRichard MacCutchan1-Oct-09 2:38 
GeneralRe: using unmanaged lib in managed class [modified] Pin
carlo.andreoli1-Oct-09 3:03
carlo.andreoli1-Oct-09 3:03 
GeneralRe: using unmanaged lib in managed class Pin
Richard MacCutchan1-Oct-09 3:29
mveRichard MacCutchan1-Oct-09 3:29 
GeneralRe: using unmanaged lib in managed class Pin
carlo.andreoli1-Oct-09 4:34
carlo.andreoli1-Oct-09 4:34 
GeneralRe: using unmanaged lib in managed class Pin
Richard MacCutchan1-Oct-09 6:21
mveRichard MacCutchan1-Oct-09 6:21 
Questioncli::array&lt;any^&gt;^ Array Pin
jashimu29-Sep-09 8:12
jashimu29-Sep-09 8:12 
AnswerRe: cli::array&lt;any^&gt;^ Array Pin
N a v a n e e t h29-Sep-09 18:58
N a v a n e e t h29-Sep-09 18:58 
GeneralRe: cli::array&lt;any^&gt;^ Array Pin
jashimu30-Sep-09 5:32
jashimu30-Sep-09 5:32 
GeneralRe: cli::array&lt;any^&gt;^ Array Pin
Richard MacCutchan30-Sep-09 23:18
mveRichard MacCutchan30-Sep-09 23:18 
GeneralRe: cli::array&lt;any^&gt;^ Array Pin
jashimu1-Oct-09 7:50
jashimu1-Oct-09 7:50 

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.