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

Managed C++/CLI

 
GeneralRe: SP Pin
led mike5-Mar-08 4:39
led mike5-Mar-08 4:39 
GeneralRe: SP Pin
Paul Conrad7-Mar-08 14:15
professionalPaul Conrad7-Mar-08 14:15 
GeneralRe: SP Pin
Mark Salsbery7-Mar-08 15:09
Mark Salsbery7-Mar-08 15:09 
GeneralRe: SP Pin
Paul Conrad7-Mar-08 15:12
professionalPaul Conrad7-Mar-08 15:12 
GeneralRe: SP Pin
led mike11-Mar-08 4:36
led mike11-Mar-08 4:36 
QuestionTree view Pin
rose1964-Mar-08 22:34
rose1964-Mar-08 22:34 
GeneralRe: Tree view Pin
Paul Conrad7-Mar-08 14:16
professionalPaul Conrad7-Mar-08 14:16 
GeneralMarshalling problem (from managed to unmanaged) Pin
s196675m3-Mar-08 7:13
s196675m3-Mar-08 7:13 
HOPEFULLY someone can help me.

I am trying to access a function from an unmanaged DLL from my visual c++ managed GUI.


Declaration of the function I am trying to import from unmanaged (native) DLL is:

extern "C" __declspec(dllexport) TGrayImage<int>* init_seg(TGrayImage<float>* pImg, TMonoImage* monoImg, int nClass)



Even though there are many functons in the DLL, only this function is exported.


Now In my GUI, I have added the following line to import that functon so that I can call that functon from GUI.

At the top of the file after using namespaces


[System::Runtime::InteropServices::DllImport("segment.dll")]
TGrayImage<int> * init_seg(TGrayImage<float>* pimg, TMonoImage* mono, int nNum);


I didn't do any Marshalling parameter. I have no idea how to Marshall a pointer to a Template class or pointer to a class. I searched before posting but I didn't get clear understanding about it.

Just for clarification, pimg and mono I am trying to pass is Managed varialble created within managed GUI.
TGrayImage<float>* pimg = new TGrayImage<float>* (width,height);// used new not gcnew
TmonoImage* mono = new TMonoImage(width, height);

I have added the proper library (compiled with pure:MSIL) in my my GUI which supplied TGrayImage,TMonoImage.

Header file for TGrayImage and TMonoImage already included in the GUI.


When I call init_seg function from GUI, I got the following message:
An unhandled exception of type 'System.AccessViolationException' occurred in GUI.exe
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.


Please help me to Marshall these parameter correctway. I will appreciate your big help.
Thank you.
GeneralRe: Marshalling problem (from managed to unmanaged) Pin
led mike3-Mar-08 7:59
led mike3-Mar-08 7:59 
GeneralRe: Marshalling problem (from managed to unmanaged) Pin
s196675m3-Mar-08 11:06
s196675m3-Mar-08 11:06 
GeneralRe: Marshalling problem (from managed to unmanaged) Pin
led mike4-Mar-08 8:07
led mike4-Mar-08 8:07 
GeneralRe: Marshalling problem (from managed to unmanaged) Pin
Mark Salsbery3-Mar-08 11:29
Mark Salsbery3-Mar-08 11:29 
GeneralRe: Marshalling problem (from managed to unmanaged) Pin
uusheikh4-Mar-08 21:27
uusheikh4-Mar-08 21:27 
GeneralRe: Marshalling problem (from managed to unmanaged) Pin
Mark Salsbery4-Mar-08 21:35
Mark Salsbery4-Mar-08 21:35 
GeneralRe: Marshalling problem (from managed to unmanaged) Pin
led mike5-Mar-08 4:32
led mike5-Mar-08 4:32 
GeneralRe: Marshalling problem (from managed to unmanaged) Pin
Mark Salsbery5-Mar-08 6:46
Mark Salsbery5-Mar-08 6:46 
Questiontool bar Pin
rose1962-Mar-08 20:56
rose1962-Mar-08 20:56 
GeneralRe: tool bar Pin
Giorgi Dalakishvili2-Mar-08 21:09
mentorGiorgi Dalakishvili2-Mar-08 21:09 
Questionhow to create a Project Location dialog box Pin
rose1962-Mar-08 18:48
rose1962-Mar-08 18:48 
GeneralRe: how to create a Project Location dialog box Pin
Mark Salsbery3-Mar-08 6:06
Mark Salsbery3-Mar-08 6:06 
QuestionCannot use null and how to declare return type of a function as array? [modified] Pin
Member 45422722-Mar-08 18:26
Member 45422722-Mar-08 18:26 
GeneralRe: Cannot use null and how to declare return type of a function as array? Pin
led mike3-Mar-08 4:58
led mike3-Mar-08 4:58 
GeneralRe: Cannot use null and how to declare return type of a function as array? Pin
Mark Salsbery3-Mar-08 6:04
Mark Salsbery3-Mar-08 6:04 
QuestionEXE vs LIB -- 30 times slower? Pin
s196675m29-Feb-08 15:14
s196675m29-Feb-08 15:14 
AnswerRe: EXE vs LIB -- 30 times slower? Pin
uusheikh4-Mar-08 21:18
uusheikh4-Mar-08 21:18 

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.