FAQ
In lmdb-go I have been making slices from using the reflect package.

https://github.com/bmatsuo/lmdb-go/blob/40ebaca9ecf9cd77b0b70fc5eb6a89c47a839187/lmdb/val.go#L99-L104

I can't remember off the top of my head where I first saw that trick. But I
  remember reading about a different project doing the same thing.

The [1<<31 - 1]byte trick is interesting though. I wonder if it is faster.
On Friday, April 1, 2016 at 6:46:09 AM UTC-7, James Bardin wrote:


On Friday, April 1, 2016 at 9:35:24 AM UTC-4, aren...@gmail.com wrote:

Thanks for your help, but this only helps with dereferencing a returned
pointer. However, the C function takes a pointer that i need to provide.
Sorry i should have pointed that out more clearly. Here is the function
definition:

CAPI(long) wkhtmltopdf_get_output(wkhtmltopdf_converter * converter,
const unsigned char **);

Give it a pointer to a nil pointer of the correct type:

var p *C.uchar
ret := wkhtmltopdf_get_output(converter, &p)
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 6 of 10 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedApr 1, '16 at 11:16a
activeApr 2, '16 at 9:55p
posts10
users4
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase