title: mock a function with a pointer-to-pointer argument
body: <p>I need to mock a function which has a pointer-to-pointer argument (thus a ** argument).</p>
  
  <p>I tried somehing lik the following piece of pseudo-code (note: NON_ZERO_ENUM_MEMBER stands for an enum-value with a value not equal to 0)</p>
  
  <pre><code>my_arg_type argument;
  argument.enummember = NON_ZERO_ENUM_MEMBER;
  
  EXPECT_CALL( *my_mock, mock_function( _, _ ) )
  .times(1)
  .WillOnce( DoAll( SetArgPointee&lt;1&gt;( &amp;argument ), Return( 0 ) ) );
  </code></pre>
  
  <p>This builds OK, but when I run my test argument.enummember is 0.</p>
  
  <p>If I'm correct this is caused by googlemock making a copy of what I want to return and in case of SetArgPointee create a pointer for it (hence that in case of a normal * one can say SetArgPointee( argument) ).
  But in this case I give an address and that address is than turned into a pointer. But the actual value of the variable is not stored (if my assumption is correct).</p>
  
  <p>Is there a standard way that googlemock can handle ** arguments or do I have to create a more 'global' variable and return the address of that variable?</p>
  
  <p>/<em>edit</em>/ moved my previous edit to the 2nd reply to keep the original question short</p>