Closed GoogleCodeExporter closed 9 years ago
Yeah, that exception came up on GDNet recently as well. I'm looking into it.
Original comment by Mike.Popoloski
on 7 Jan 2009 at 3:17
[deleted comment]
[deleted comment]
[deleted comment]
I think this might help. The problem is it is trying to create a pointer to a
non-
native object.
http://social.msdn.microsoft.com/forums/en-US/clr/thread/dd7a3afe-baef-49b5-a088
-
f4c68658de42
This is how it was done in the March SDk.
DeviceCollection^ results = gcnew DeviceCollection();
std::auto_ptr<DeviceCollectionShim> shim( new DeviceCollectionShim( results ) );
HRESULT hr = DirectSoundEnumerate(
static_cast<LPDSENUMCALLBACK>(EnumerateDevices ),
shim.get() );
if( RECORD_DSOUND( hr ).IsFailure )
return nullptr;
return results;
Original comment by Grasshop...@gmail.com
on 8 Jan 2009 at 12:54
Fixed as of r861.
Original comment by Mike.Popoloski
on 14 Jan 2009 at 7:57
Original comment by Mike.Popoloski
on 14 Jan 2009 at 7:57
Wouldn't it be better to create the shim as a template class that could be used
for
other things?
template <class T> class Wrapper
{
public:
Wrapper<T>(T obj) : _object(obj) {}
T Unwrap() { return _object; }
private:
gcroot<T> _object;
};
And then define the code like:
DeviceCollection^ results = gcnew DeviceCollection();
std::auto_ptr<Shim<DeviceCollection^>> shim(new Wrapper<DeviceCollection^>
(results));
HRESULT hr = DirectSoundEnumerate(static_cast<LPDSENUMCALLBACK>
(EnumerateDevices), shim.Unwrap());
Original comment by Crystal_...@hotmail.com
on 15 Jan 2009 at 8:22
Wanted to add one more thing, why was the auto_ptr<> class added to the code?
This
can be found in STL.
#include <memory>
It is in the std namespace, so you can access it through std::auto_ptr<>.
Original comment by Crystal_...@hotmail.com
on 15 Jan 2009 at 3:56
auto_array, which Mike added, is not auto_ptr. In particular auto_ptr calls
delete,
when in this scenario delete[] needed to be called.
Original comment by josh.petrie
on 15 Jan 2009 at 4:47
Ah, my bad. I saw another post regarding these changes that had auto_ptr<> in
it and
tried to connect the dots. But apparently there was a problem between the
keyboard
and the chair. :)
Original comment by Crystal_...@hotmail.com
on 16 Jan 2009 at 3:37
I still have the problem with the november 2008 version. How can i relate a
build
with the corresponding version?
Original comment by steve.a.beaudoin
on 5 Mar 2009 at 1:38
You can wait for the next public release (should be some time in the few weeks)
or
download from source and build it yourself.
Original comment by Mike.Popoloski
on 5 Mar 2009 at 1:59
Original issue reported on code.google.com by
Grasshop...@gmail.com
on 7 Jan 2009 at 11:22