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

Managed C++/CLI

 
AnswerRe: DLL export function should wait for a flag set from WndProc - OnDeviceCahnge. How?? Pin
hariharasuthan29-Nov-05 1:24
hariharasuthan29-Nov-05 1:24 
GeneralRe: DLL export function should wait for a flag set from WndProc - OnDeviceCahnge. How?? Pin
kk_vp29-Nov-05 2:07
kk_vp29-Nov-05 2:07 
QuestionGrabbing the Class from DLL Pin
Bobamagoo28-Nov-05 21:20
Bobamagoo28-Nov-05 21:20 
AnswerRe: Grabbing the Class from DLL Pin
Nish Nishant29-Nov-05 0:18
sitebuilderNish Nishant29-Nov-05 0:18 
GeneralRe: Grabbing the Class from DLL Pin
Bobamagoo29-Nov-05 1:00
Bobamagoo29-Nov-05 1:00 
Question[Interview Question ] Difference between C++ Structure and Class Pin
sudeesht28-Nov-05 20:32
sudeesht28-Nov-05 20:32 
AnswerRe: [Interview Question ] Difference between C++ Structure and Class Pin
toxcct28-Nov-05 21:34
toxcct28-Nov-05 21:34 
QuestionPassing Managed Code from DLLs Pin
Bobamagoo28-Nov-05 12:22
Bobamagoo28-Nov-05 12:22 
Ok, my last post was just too big. I'll try to shorten it here. I'm trying to load DLLs dynamically using the LoadLibrary/GetProcAddress method. What I want to do is call a function in the DLL that creates an instance of the class I need. However I am getting an error:

System.Runtime.InteropServices.MarshalDirectiveException in Unknown Module
PInvoke Restriction: can not return variants


I'm not sure what is wrong, but it seems to be a problem with the variable.

The function looks like this:
Object __gc * __cdecl Build()<br />
{<br />
    LeetTrans * a = new LeetTrans();<br />
    return a;<br />
}


The head of LeetTrans looks like this:
public __gc class LeetTrans : public Wompi

And the head of Wompi looks like this:
public __gc class Wompi : public System::Windows::Forms::GroupBox

Now for the loader code,
typedef Object __gc * (__cdecl *Builder)();<br />
    Builder build;<br />
    FARPROC holder;<br />
    Object __gc * wompi;


Here's where we cast the function and simply call the function to Wompi:
build = (Object __gc*(*)()) holder;<br />
wompi = build();


This is where our error occurs. So I'm guessing I'm losing the variable somewhere along the way, but I don't know where to begin. Any help would be greatly appreciated. Thank you.

-- modified at 18:23 Monday 28th November, 2005
AnswerRe: Passing Managed Code from DLLs Pin
Nish Nishant28-Nov-05 13:33
sitebuilderNish Nishant28-Nov-05 13:33 
GeneralRe: Passing Managed Code from DLLs Pin
Bobamagoo28-Nov-05 13:43
Bobamagoo28-Nov-05 13:43 
GeneralRe: Passing Managed Code from DLLs Pin
Nish Nishant28-Nov-05 14:36
sitebuilderNish Nishant28-Nov-05 14:36 
GeneralRe: Passing Managed Code from DLLs Pin
Bobamagoo28-Nov-05 15:14
Bobamagoo28-Nov-05 15:14 
QuestionStrange VS Behavior Pin
Saksida Bojan28-Nov-05 10:09
Saksida Bojan28-Nov-05 10:09 
AnswerRe: Strange VS Behavior Pin
Nish Nishant28-Nov-05 11:04
sitebuilderNish Nishant28-Nov-05 11:04 
QuestionFixed toolbars in SDI app Pin
RoyceF27-Nov-05 17:40
RoyceF27-Nov-05 17:40 
AnswerRe: Fixed toolbars in SDI app Pin
Nish Nishant28-Nov-05 11:57
sitebuilderNish Nishant28-Nov-05 11:57 
GeneralRe: Fixed toolbars in SDI app Pin
RoyceF30-Nov-05 10:13
RoyceF30-Nov-05 10:13 
QuestionThread Safety Pin
dskips27-Nov-05 11:35
dskips27-Nov-05 11:35 
AnswerRe: Thread Safety Pin
mikanu28-Nov-05 5:07
mikanu28-Nov-05 5:07 
QuestionExit Process Pin
Saksida Bojan27-Nov-05 10:54
Saksida Bojan27-Nov-05 10:54 
AnswerRe: Exit Process Pin
dskips27-Nov-05 11:47
dskips27-Nov-05 11:47 
AnswerRe: Exit Process - stupid html Pin
dskips27-Nov-05 11:49
dskips27-Nov-05 11:49 
GeneralRe: Exit Process - stupid html Pin
Saksida Bojan27-Nov-05 18:40
Saksida Bojan27-Nov-05 18:40 
AnswerRe: Exit Process Pin
Nish Nishant28-Nov-05 5:20
sitebuilderNish Nishant28-Nov-05 5:20 
AnswerRe: Exit Process Pin
Nish Nishant28-Nov-05 5:22
sitebuilderNish Nishant28-Nov-05 5:22 

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.