diff --git a/ph7.go b/ph7.go index 51bb6b0..c99a908 100644 --- a/ph7.go +++ b/ph7.go @@ -1,6 +1,7 @@ package ph7 /* +#include #include "ph7.h" int engine_config_err_log(ph7 *pEngine, const char **pzPtr, int *pLen) { @@ -14,6 +15,7 @@ int vm_extract_output(ph7_vm *pVm, const char **pzPtr, int *pLen) { import "C" import ( "fmt" + "io" ) type ResultCode int @@ -97,6 +99,7 @@ func (e Engine) ErrLog() (string, error) { func (e Engine) Compile(source []byte, phpOnly bool) (*VM, error) { csource := C.CBytes(source) + defer C.free(csource) vm := new(VM) var flags C.int if phpOnly { @@ -107,7 +110,6 @@ func (e Engine) Compile(source []byte, phpOnly bool) (*VM, error) { return nil, err } - // TODO free csource return vm, nil } @@ -119,6 +121,10 @@ type VM struct { ptr *C.ph7_vm } +func (vm VM) SetOutputWriter(w io.Writer) error { + return nil +} + func (vm VM) ExtractOutput() (string, error) { var s *C.char var n C.int