Using CFFI: dealing with a writeback buffer

Victor bobbie at ua.fm
Tue Jul 14 14:37:35 UTC 2015


Hi all,

I don't know if it is the best place to ask this question, but I'll try it. I am trying to wrap around a following function:

OGRErr OSRExportToProj4(OGRSpatialReferenceH r, char **buff);

This function allocates the string and assigns it to the (char*) pointer passed as buff and then its contents should be copied into a C string and the obtained pointer released via CPLFree();

So, basically, in C a typical usage would be:

  char *proj = NULL:
  OSRExportToProj4(handle, &proj);
  printf("%s\n", proj);
  CPLFree(proj);

And the question is: how is this function should be wrapped with CFFI?

Thanks,
Victor

-- реклама -----------------------------------------------------------
FREEhost.UA - быстрый и удобный хостинг доступный каждому.
http://freehost.com.ua/unix/



More information about the cffi-devel mailing list