On Wed, Apr 24, 2019 at 1:51 PM Nitish Saboo <nitish.sabo...@gmail.com> wrote:
>
> Hi,
>
> I followed the link 
> 'https://github.com/golang/go/wiki/cgo#function-variables' and  made the 
> following changes:
> 1)main.go
> package main
> //#cgo CFLAGS: -I./syslog-ng-3.6.2/
> //#cgo LDFLAGS: syslog-node.so
> //#cgo LDFLAGS: -L/usr/local/lib/ -lsyslog-ng
> //#cgo LDFLAGS: -L/usr/local/lib/syslog-ng -ldbparser
> //#cgo CFLAGS: -I.
> //void callOnMeGo_cgo(char *key, char *value, size_t value_len);  <<<<<

size_t is going to be undefined here.. Also the chars after ';' should
not be there

> // #include "syslog-node1.h"
> //#include <stdlib.h>
> import "C"
>
> //export CallBack
> func CallBack(key *C.char, value *C.char, value_len C.size_t){
>
>     if remap, ok := field_mappings[C.GoString(key)]; ok {
>         fmt.Println(key, remap)//Need to check how field mappings work
>     }
>
> }
>
> func ReloadPatternDB(opts Y){

Where from type Y comes?

>
>     x := C.CString(opts.x)
>     C.reload_pattern_db(x, 
> (C.key_value_cb)(unsafe.Pointer(C.callOnMeGo_cgo)));
>
> }
>
> 2)Created a file 'cfuncs.go'
> ====================
> package main

Package main must have func main(). Where it is?

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to