title: How to get value of char pointer from Python code wtih ctypes
body: <p>I want to use C library on Python.
  Then, I want to get message ( char* ) from C library fanction.</p>
  
  <p>I wrote these codes.
  I got result value(double* result_out) , but I didn't get message. 
  This code shown "c_char_p(None)".</p>
  
  <p>Any ideas?</p>
  
  <p>I use Python 3.6, and Ubuntu Bash.</p>
  
  <p>C (libdiv.so):</p>
  
  <pre><code>#define ERROR -1
  #define OK     0
  
  int div (double x, double y, char *msg, double *result_out) {
      static char *err_msg = "0 div error"; 
      if(y == 0) {
          msg = err_msg;
          return ERROR;
      }
      *result_out = x/y;
      return OK;
  }
  </code></pre>
  
  <p>Python:</p>
  
  <pre><code>from ctypes import *
  
  lib = cdll.Loadlibrary('libdiv.so')
  errmsg = c_char_p()
  result = c_double(0)
  rtn = lib.div(10, 0, errmsg, byref(result))
  
  if rtn &lt; 0:
      print (errmsg)       # None    
  else :
      print (result.value) # OK.
  </code></pre>