The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

weinreic (1) [Avatar] Offline
#1
I am working on modifying a dll (or is it assembly?) consisting of one .h file and one .cpp file written in c++/cli, in order to make it accessible to a c# program. [The context is use of the WASAPI api.] In the process, I have succesfully modified a call involving a c++ pointer as follows: The original code was

[in .h file:]

IMMDeviceEnumerator *pEnumerator_R;

[in .cpp file:]

hr = CoCreateInstance(
CLSID_MMDeviceEnumerator,
NULL,
CLSCTX_ALL,
IID_IMMDeviceEnumerator,
(void**)&pEnumerator_R);

In response to a build error message, I modified the .cpp file as follows:

//=========================================1 begin
pin_ptr<IMMDeviceEnumerator> piEnumerator_R;
//=========================================1 end
. . . .
hr = CoCreateInstance(
CLSID_MMDeviceEnumerator,
NULL,
CLSCTX_ALL,
IID_IMMDeviceEnumerator,
(void**)&piEnumerator_R);

This was accepted by the compiler. However, in a different place the original required a pointer to a pointer, which made me want to substitute a pin_ptr to a pin_ptr, I did not (after some experimentation) find a way of defining it that the compiler would accept. I would appreciate some help.