title: Update values of a struct pointer in ctypes python without using a C function
body: <p>I'm having a C function that returns a pointer to an struct:</p>
  
  <pre class="lang-c prettyprint-override"><code>struct iperf_test *
  iperf_new_test()
  {
      struct iperf_test *test;
  
      test = (struct iperf_test *) malloc(sizeof(struct iperf_test));
      ...
      return test;
  }
  </code></pre>
  
  <p>This function is called from Python in the following way:</p>
  
  <pre class="lang-py prettyprint-override"><code>self.lib = cdll.LoadLibrary("lib.so")
  self._test = self.lib.iperf_new_test()
  </code></pre>
  
  <p>The struct has some values such as:</p>
  
  <pre class="lang-c prettyprint-override"><code>struct iperf_test
  {
      int       server_port;
      int       bind_port; 
  };
  </code></pre>
  
  <p>The examples I see on the internet shows that I need to use a function that receives a pointer to alter the values, for example in python:</p>
  
  <pre class="lang-py prettyprint-override"><code>self.lib.iperf_set_test_server_port(self._test, int(port))
  </code></pre>
  
  <p>And in C:</p>
  
  <pre class="lang-c prettyprint-override"><code>void
  iperf_set_test_server_port(struct iperf_test *ipt, int srv_port)
  {
      ipt-&gt;server_port = srv_port;
  }
  </code></pre>
  
  <p>Is there a way to <strong>change the value bind_port directly</strong> without using a C function?</p>