Rob Collis
August 3rd, 1999, 03:20 PM
My project has one worrying problem that I cannot solve;
The COM project compiles and I can write a Visual Basic 6 client to use the
C++ COM module. However, when the VB client ends (and therefore destructs
it's global scope instance of an COM object inside the COM C++ library) VB
crashes with a illegal memory write error.
The important bits to know are:
The VC++ COM code uses VC++6 (no service pack), ATL 3, RogueWave Tools++ and
DBTools++ libraries.
The project is quite simple really. In the C++ I am
using ICollectionOnSTLImpl<> template class to implement a VB Collection of
VARIANTS and then pass a single VARIANT from VB client into C++ for
processing to another ATL simple object which in turn returns an instance of
the collection class.
so that (in VB)
Sub Main
dim x as new MyCOMLib.controller
dim f as new MyComLib.field
with f
.property1 = "prop1"
.value1 = 123.45
end with
dim fieldsback as MyComLib.fields
set fieldsback = x.process(f)
dim fo as MyComLib.field
for each fo in fieldsback
....
next
set x = nothing ' This is where the C++ goes BANG!
End Sub
Any clues?
Rob
The COM project compiles and I can write a Visual Basic 6 client to use the
C++ COM module. However, when the VB client ends (and therefore destructs
it's global scope instance of an COM object inside the COM C++ library) VB
crashes with a illegal memory write error.
The important bits to know are:
The VC++ COM code uses VC++6 (no service pack), ATL 3, RogueWave Tools++ and
DBTools++ libraries.
The project is quite simple really. In the C++ I am
using ICollectionOnSTLImpl<> template class to implement a VB Collection of
VARIANTS and then pass a single VARIANT from VB client into C++ for
processing to another ATL simple object which in turn returns an instance of
the collection class.
so that (in VB)
Sub Main
dim x as new MyCOMLib.controller
dim f as new MyComLib.field
with f
.property1 = "prop1"
.value1 = 123.45
end with
dim fieldsback as MyComLib.fields
set fieldsback = x.process(f)
dim fo as MyComLib.field
for each fo in fieldsback
....
next
set x = nothing ' This is where the C++ goes BANG!
End Sub
Any clues?
Rob