Hello Victor,

I think you're looking for something along these lines.

(with-foreign-object (proj :pointer)
  (osr-export-to-proj-4 handle proj)
  (let ((p (mem-ref proj :pointer)))
    (write-line (foreign-string-to-lisp p))
    (cpl-free p)))

Cheers,
Luís

(painstakingly typed on a phone)


On Tue, Jul 14, 2015, 14:37 Victor <bobbie@ua.fm> wrote:
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/

--

Luís

(sent from my phone)