> What other native classes are not usable in a _gc class?
With one exception, all native classes cannot be embedded in a __gc class.
The exception is POD types (a POD is short for "plain old data" and is a
class that neither has a user defined copy constructor nor a user defined
destructor, and contains only other PODs or scalar data).
> I use managed C++ as the bridge between my native C++ code and C#. If I
> was doing pure .NET code, I would use C#.
I understand your position. This too is a sentiment we are looking to fix in
the next version of Visual C++.
Cheerio!

Signature
Brandon Bray Visual C++ Compiler
This posting is provided AS IS with no warranties, and confers no rights.
Bill Burris - 30 Sep 2003 16:44 GMT
> With one exception, all native classes cannot be embedded in a __gc class.
> The exception is POD types (a POD is short for "plain old data" and is a
> class that neither has a user defined copy constructor nor a user defined
> destructor, and contains only other PODs or scalar data).
I have been using destructors in my managed C++. It seems to work ok.
Some __gc code which uses native classes:
CMDAQ::CMDAQ( IMessageHandler* pMessageHandler, int siteId, int
interfaceType )
{
itsMessageDispatcher = new CMessageDispatcher();
itsMessageDispatcher->itsMessageHandler = pMessageHandler;
CDebug::Initialize( itsMessageDispatcher );
try
{
itsDAQControl = new CDAQControl( itsMessageDispatcher, siteId,
interfaceType );
itsHistogramGroup = itsDAQControl->GetHistogramGroup();
itsPhantomHistogramGroup = itsDAQControl->GetPhantomHistogramGroup();
}
catch( char* str )
{
itsMessageDispatcher->DebugMessage( str );
throw( new System::Exception( str ) );
}
}
CMDAQ::~CMDAQ()
{
delete itsDAQControl;
delete itsMessageDispatcher;
}
This is used in my C# code as follows:
public class DAQ
{
private static CMDAQ itsDaq = null;
private IMessageHandler itsMessageHandler;
public DAQ( IMessageHandler messageHandler, int interfaceType, int
siteId )
{
itsMessageHandler = messageHandler;
itsDaq = new CMDAQ( itsMessageHandler, siteId, interfaceType );
}
public void Dispose()
{
itsDaq.__dtor();
}
Dispose is called in the OnClosing funtion for my Form:
protected override void OnClosing( CancelEventArgs e )
{
base.OnClosing( e );
if( itsState == ProgState.DAQ )
{
itsDaq.Stop();
itsDaq.Dispose();
itsSettings.Save( @"c:\alta_prog\33\ProgramSettings.xml" );
}
}
Bill
Bill Burris - 30 Sep 2003 17:03 GMT
> > I use managed C++ as the bridge between my native C++ code and C#. If I
> > was doing pure .NET code, I would use C#.
>
> I understand your position. This too is a sentiment we are looking to fix in
> the next version of Visual C++.
Even better would be if I could do everything in C#. For that to happen I
need serial port support in .NET, or device drivers for Motorola GPS
receivers which are usable in .NET. Also Measurement Computing
http://www.measurementcomputing.com/, hardware needs to be accessible from
.NET, and a .NET version of Tetradyne DriverX
http://www.tetradyne.com/driverx.htm.
Support for USB would also come in handy. I tried to roll my own but didn't
get very far. What I did do is posted at
http://www.componentsnotebook.com/notebooks/csharp/deviceio.aspx.
Bill