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

Managed C++/CLI

 
GeneralRe: Managed strings and buffers to nonmanaged Pin
Nathan Blomquist11-Jul-03 11:02
Nathan Blomquist11-Jul-03 11:02 
GeneralRe: Managed strings and buffers to nonmanaged Pin
jspano15-Jul-03 8:56
jspano15-Jul-03 8:56 
Generalstorage of images into oracle database using vc++.net Pin
Shaffiq7-Jul-03 7:49
Shaffiq7-Jul-03 7:49 
GeneralSetup for networks using Vstudio .NET 2003 Pin
BoudewijnEctor3-Jul-03 23:34
BoudewijnEctor3-Jul-03 23:34 
GeneralRe: Setup for networks using Vstudio .NET 2003 Pin
Heath Stewart11-Jul-03 5:59
protectorHeath Stewart11-Jul-03 5:59 
GeneralLinking Errors (operator new redifined) mixing MFC and .NET Pin
DarrylB29-Jun-03 23:56
DarrylB29-Jun-03 23:56 
GeneralMore on mixing managed code and API code Pin
Jeremy Osner27-Jun-03 4:13
Jeremy Osner27-Jun-03 4:13 
GeneralRe: More on mixing managed code and API code Pin
Jeremy Osner27-Jun-03 8:42
Jeremy Osner27-Jun-03 8:42 
I have come up with a stop-gap solution but it is quite inelegant and defeats the purpose, somewhat, of managed classes. It is this:

__gc class MyClass
{
static MyClass *instances;
MyClass *next;
public:
MyClass(): next(instances) { instances = this; }
MyClass *Lookup(HANDLE h) { /*iterate thru linked list til you find it */ }
}

When the callback enters it can call MyClass::Lookup and then use the returned instance to deal with the callback. *But* MyClass instances will never be deleted (if my understanding of __gc is correct) -- I have to add a Shutdown() function to remove the instance from the list -- and call this function just before the last referance to the instance goes out of scope.

What I want is a way to declare non-__gc pointers to managed type objects -- then the destructor of a MyClass would be called when the last __gc reference to it went out of scope, and the destructor could then be responsible for cleaning up the instances list and deregistering the callback. But it seems like there is no way to do this.

Maybe what I should do, is make MyClass be non-managed but give it a managed wrapper class. Then I think I can do exactly what I want. I will give this a try and report back.

READIN writin and rhythmetic
GeneralCreating Inherited forms Pin
sivaramakrishna26-Jun-03 19:44
sivaramakrishna26-Jun-03 19:44 
GeneralRe: Creating Inherited forms Pin
Nick Hodapp9-Jul-03 7:04
sitebuilderNick Hodapp9-Jul-03 7:04 
QuestionHow to mix managed code and API code? Pin
Jeremy Osner26-Jun-03 7:41
Jeremy Osner26-Jun-03 7:41 
AnswerRe: Figured it out! Pin
Jeremy Osner26-Jun-03 7:49
Jeremy Osner26-Jun-03 7:49 
GeneralRe: Figured it out! Pin
Nathan Blomquist27-Jun-03 1:54
Nathan Blomquist27-Jun-03 1:54 
GeneralRe: Figured it out! Pin
Jeremy Osner27-Jun-03 2:20
Jeremy Osner27-Jun-03 2:20 
Generalconverting an idl file to .h Pin
si_6926-Jun-03 0:37
si_6926-Jun-03 0:37 
GeneralRe: converting an idl file to .h Pin
leppie26-Jun-03 7:17
leppie26-Jun-03 7:17 
Generalmouse pointer movement Pin
mujay23-Jun-03 2:42
mujay23-Jun-03 2:42 
GeneralShared Assembly Problem Pin
SuperGeek20-Jun-03 15:31
SuperGeek20-Jun-03 15:31 
GeneralRe: Shared Assembly Problem Pin
James T. Johnson20-Jun-03 15:49
James T. Johnson20-Jun-03 15:49 
GeneralRe: Shared Assembly Problem Pin
SuperGeek20-Jun-03 16:07
SuperGeek20-Jun-03 16:07 
GeneralRe: Shared Assembly Problem Pin
James T. Johnson20-Jun-03 17:18
James T. Johnson20-Jun-03 17:18 
GeneralRe: Shared Assembly Problem Pin
SuperGeek21-Jun-03 6:44
SuperGeek21-Jun-03 6:44 
GeneralRe: Shared Assembly Problem Pin
James T. Johnson21-Jun-03 7:02
James T. Johnson21-Jun-03 7:02 
GeneralRe: Shared Assembly Problem Pin
SuperGeek21-Jun-03 8:33
SuperGeek21-Jun-03 8:33 
GeneralRe: Shared Assembly Problem Pin
SuperGeek21-Jun-03 9:48
SuperGeek21-Jun-03 9:48 

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.