lucy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philip Southam <>
Subject Re: [lucy-user] GO (aka golang) Client Bindings for Lucy
Date Fri, 23 Aug 2013 05:14:47 GMT
Had some time to think about it on my long drive home and got it figured
out. The key was to add my own "conversion" function in the comment
preceding the `import "C"` deceleration as trying to cast from
`uint8_t*` to `char*` in the Go code wouldn't work.

	...Some imports and cgo flags up here...
	extern char* cfish_cb_ptr2char(const cfish_CharBuf * field) {
	    return (char*)CFISH_CB_Get_Ptr8(field);
	import "C"

Now in the loop I have access to it like so.

	value_cb := C.LUCY_HitDoc_Extract(hit, field_cb, nil)
	key := C.cfish_cb_ptr2char(value_cb)
	fmt.Printf("Result %d %s\n", i, C.GoString(key))

Now it's time to see if I can implement a "real world" scenario.
Philip Southam
Chief Architect / Яeverse Эngineer

View raw message