mirror of
https://github.com/sjwhitworth/golearn.git
synced 2025-04-28 13:48:56 +08:00
28 lines
498 B
Go
28 lines
498 B
Go
![]() |
// +build go1.2
|
||
|
|
||
|
package linear_models
|
||
|
|
||
|
/*
|
||
|
#cgo LDFLAGS: -llinear
|
||
|
#cgo CFLAGS:
|
||
|
#include <linear.h>
|
||
|
|
||
|
typedef void (*print_func)(char *);
|
||
|
void golearn_liblinear_print_func_cgo(char *);
|
||
|
*/
|
||
|
import "C"
|
||
|
|
||
|
import (
|
||
|
"github.com/sjwhitworth/golearn/base"
|
||
|
"unsafe"
|
||
|
)
|
||
|
|
||
|
//export libLinearPrintFunc
|
||
|
func libLinearPrintFunc(str *C.char) {
|
||
|
base.Logger.Println(C.GoString(str))
|
||
|
}
|
||
|
|
||
|
func libLinearHookPrintFunc() {
|
||
|
C.set_print_string_function((C.print_func)(unsafe.Pointer(C.golearn_liblinear_print_func_cgo)))
|
||
|
}
|