Re: Invalid handle exceptions always thrown by VS2008

Giganews Newsgroups
Subject: Re: Invalid handle exceptions always thrown by VS2008
Posted by:  Ken Hill (kenneth_hi…@msn.com)
Date: Mon, 3 Nov 2008

I found the problem.

I had a statement as follows

static my_type (&ary_ref)[8] = foo;

where foo was an array of my_type objects previously constructed in a
shared-memory segment.  foo is also 8 elements in size.  The above
statement was defined outside of any class.  foo has a handle as a
member element.

It turns out that the compiler no longer generates the same code in
this case as VC7 did - It creates the ary_ref in some other memory,
perhaps overwriting other objects.

I changed the code to the following and it now works without the
invalid handle exceptions.

static my_type *ary_ref = foo;

Now both foo and *ary_ref occupy the same memory.

I'm still perplexed why I got invalid handle exceptions even when I
had them turned off.  If anybody has any ideas about that, it would be
interesting to have this posted.

Cheers,
Ken

Replies

None

In response to

Invalid handle exceptions always thrown by VS2008 posted by Ken Hill on Mon, 3 Nov 2008