simple question, *__gc

  • Thread starter Thread starter EP
  • Start date Start date
E

EP

I have a simple question but I can't find it on any newsgroups.

I have a MC++ class that contains a private field of native type
private:
HTTP_RESPONSE _httpResponse.

I need to get it's address
HTTP_RESPONSE* pResponse = &(this->_httpResponse);

But I get this build error
error C2440: 'initializing' : cannot convert from 'HTTP_RESPONSE
__gc *' to 'HTTP_RESPONSE *'

Can I store this structure as a member of my class and then work with it as
an unmanaged type?
 
EP said:
I have a simple question but I can't find it on any newsgroups.

I have a MC++ class that contains a private field of native type
private:
HTTP_RESPONSE _httpResponse.

I need to get it's address
HTTP_RESPONSE* pResponse = &(this->_httpResponse);

But I get this build error
error C2440: 'initializing' : cannot convert from 'HTTP_RESPONSE
__gc *' to 'HTTP_RESPONSE *'

Can I store this structure as a member of my class and then work with it as
an unmanaged type?


Yes, but you need to make sure the garbage collector won't move it
around behind your back, by using a pinning pointer. Declare pResponse
as a HTTP_RESPONSE __pin * and it should work.

Jesse
 
Back
Top