Preview:
class Wrapper
{
 private:
  CLib *lib;

 public:
  Wrapper() { lib = lib_init(); } // Lib initialisieren
  ~Wrapper() { lib_cleanup(&init); } // Lib freigeben

  std::string DoSomething() 
  { 
    char *cstr = lib_get_str(); // String anfordern (malloc!)

    std::string s = str;  // in std::string kopieren

    lib_free_str(cstr); // String freigeben (free)

    return s; // std::string zurückgeben. Alles easy.
  }
};
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter