title: MacRuby pointer, referencing, dereferencing when using Cocoa Frameworks
body: <p>On <a href="https://stackoverflow.com/questions/17899102/macruby-pointer-to-typedef-struct">MacRuby Pointer to typedef struct</a>, I learnt how to dereference a pointer created with</p>
  
  <pre><code>x=Pointer.new_with_type
  ...
  ==&gt; use x.value, or x[0]
  </code></pre>
  
  <p>Works a treat !</p>
  
  <p>Now I want to learn what I believe to be the "opposite". I'm trying to use this API.</p>
  
  <pre><code>OSStatus SecKeychainCopySettings (
     SecKeychainRef keychain,
     SecKeychainSettings *outSettings
  );
  </code></pre>
  
  <p>Second parameter must be a Pointer. But I never manage to get the real outSettings of the keychain opened, I only get the default settings.</p>
  
  <pre><code>framework 'Security'
  keychainObject = Pointer.new_with_type('^{OpaqueSecKeychainRef}')
  SecKeychainOpen("/Users/charbon/Library/Keychains/Josja.keychain",keychainObject)
  
  #attempt #1
  settings=Pointer.new_with_type('{SecKeychainSettings=IBBI}')
  SecKeychainCopySettings(keychainObject.value, settings)
  p settings.value
  #&lt;SecKeychainSettings version=0 lockOnSleep=false useLockInterval=false lockInterval=0&gt;
  
  #attempt #2
  settings2=SecKeychainSettings.new
  result = SecKeychainCopySettings(keychainObject.value, settings2)
  p settings2
  #&lt;SecKeychainSettings version=0 lockOnSleep=false useLockInterval=false lockInterval=0&gt;
  </code></pre>
  
  <p>The settings of the Keychain opened should read</p>
  
  <pre><code>#&lt;SecKeychainSettings version=0 lockOnSleep=true useLockInterval=true lockInterval=1800&gt;
  </code></pre>
  
  <p>What am I missing ?</p>