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

Managed C++/CLI

 
AnswerRe: C++/CLI being used with VB and VC++ Pin
N a v a n e e t h14-Jul-09 16:12
N a v a n e e t h14-Jul-09 16:12 
GeneralRe: C++/CLI being used with VB and VC++ Pin
Shadowsoal15-Jul-09 4:13
Shadowsoal15-Jul-09 4:13 
GeneralRe: C++/CLI being used with VB and VC++ Pin
Shadowsoal15-Jul-09 5:21
Shadowsoal15-Jul-09 5:21 
GeneralRe: C++/CLI being used with VB and VC++ Pin
N a v a n e e t h15-Jul-09 17:49
N a v a n e e t h15-Jul-09 17:49 
GeneralRe: C++/CLI being used with VB and VC++ Pin
Shadowsoal15-Jul-09 17:52
Shadowsoal15-Jul-09 17:52 
GeneralRe: C++/CLI being used with VB and VC++ Pin
N a v a n e e t h15-Jul-09 18:23
N a v a n e e t h15-Jul-09 18:23 
QuestionNeed to call C++ function callback from C code in a Windows Form app Pin
KawiRider13-Jul-09 15:44
KawiRider13-Jul-09 15:44 
AnswerRe: Need to call C++ function callback from C code in a Windows Form app Pin
Mark Salsbery14-Jul-09 6:48
Mark Salsbery14-Jul-09 6:48 
KawiRider wrote:
int retval = CFunction("Dummy path", Marshal::GetFunctionPointerForDelegate(FuncDelegate).ToPointer()); // THIS LINE FAILS


I'm assuming your C code is in a separate DLL....

If you use platform invoke to call the C function then you should only need
something like this:
delegate void FuncCallbackDelegate(String^ str, int status);

[DllImport("My_C_Dll.dll", CharSet = CharSet::Ansi, CallingConvention = CallingConvention::StdCall)]
extern "C" int CFunction(String ^src_path, FuncCallbackDelegate ^del);

    ...		

    public: void funcCallback(String^ str, int status)
    {
        printf("Passed in string: %s\n", str);	
    }	
	
    private: System::Void btnStartTest_Click(System::Object^  sender, System::EventArgs^  e) 
    {
        FuncCallbackDelegate^ FuncDelegate = gcnew FuncCallbackDelegate(this, &Form1::funcCallback);	
        int retval = CFunction("Dummy path", FuncDelegate);
    }

    ...


Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: Need to call C++ function callback from C code in a Windows Form app Pin
KawiRider14-Jul-09 8:59
KawiRider14-Jul-09 8:59 
GeneralRe: Need to call C++ function callback from C code in a Windows Form app Pin
Mark Salsbery14-Jul-09 9:49
Mark Salsbery14-Jul-09 9:49 
GeneralRe: Need to call C++ function callback from C code in a Windows Form app Pin
KawiRider14-Jul-09 12:13
KawiRider14-Jul-09 12:13 
GeneralRe: Need to call C++ function callback from C code in a Windows Form app Pin
Daniel Grunwald20-Jul-09 4:47
Daniel Grunwald20-Jul-09 4:47 
QuestionSample for migrating C++ console app Pin
alleyes13-Jul-09 7:52
professionalalleyes13-Jul-09 7:52 
AnswerRe: Sample for migrating C++ console app Pin
Randor 14-Jul-09 11:24
professional Randor 14-Jul-09 11:24 
GeneralRe: Sample for migrating C++ console app Pin
alleyes15-Jul-09 2:24
professionalalleyes15-Jul-09 2:24 
QuestionPlease Help -- Link Error in Managed Wrapper Pin
Bharat Mallapur11-Jul-09 8:55
Bharat Mallapur11-Jul-09 8:55 
AnswerRe: Please Help -- Link Error in Managed Wrapper Pin
Bharat Mallapur13-Jul-09 23:14
Bharat Mallapur13-Jul-09 23:14 
QuestionMixed DLL Pin
cherrymotion10-Jul-09 5:29
cherrymotion10-Jul-09 5:29 
AnswerRe: Mixed DLL Pin
Richard Andrew x6414-Jul-09 20:12
professionalRichard Andrew x6414-Jul-09 20:12 
QuestionCEdit Phone number Pin
DanYELL9-Jul-09 10:00
DanYELL9-Jul-09 10:00 
AnswerRe: CEdit Phone number Pin
teejayem14-Jul-09 7:17
teejayem14-Jul-09 7:17 
QuestionDeclaring variables as 'new' in C++ CLR - Heap or GCHeap? Pin
Will58019-Jul-09 5:31
Will58019-Jul-09 5:31 
AnswerRe: Declaring variables as 'new' in C++ CLR - Heap or GCHeap? Pin
Mark Salsbery9-Jul-09 6:49
Mark Salsbery9-Jul-09 6:49 
QuestionCLR C++ Q. Does BYTE b[10] create a ref class System.Array? Pin
Will58019-Jul-09 3:15
Will58019-Jul-09 3:15 
AnswerRe: CLR C++ Q. Does BYTE b[10] create a ref class System.Array? Pin
Mark Salsbery9-Jul-09 6:50
Mark Salsbery9-Jul-09 6: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.