Fix PVD connection

This commit is contained in:
bloeys
2022-01-17 14:41:47 +04:00
parent eb8eea6c44
commit 6fe8f6eba1
2 changed files with 3 additions and 7 deletions

View File

@ -6,10 +6,9 @@ import (
func main() { func main() {
f := pgo.CreateFoundation() f := pgo.CreateFoundation()
defer f.Release()
println("foundation:", f) println("foundation:", f)
pvdTr := pgo.DefaultPvdSocketTransportCreate("0.0.0.0", 5426, 100000) pvdTr := pgo.DefaultPvdSocketTransportCreate("127.0.0.1", 5425, 100000)
println("Pvd transport:", pvdTr) println("Pvd transport:", pvdTr)
pvd := pgo.CreatePvd(f) pvd := pgo.CreatePvd(f)

View File

@ -34,7 +34,6 @@ void CPxSceneDesc_set_gravity(struct CPxSceneDesc*, struct CPxVec3);
void CPxSceneDesc_set_cpuDispatcher(struct CPxSceneDesc*, struct CPxCpuDispatcher*); void CPxSceneDesc_set_cpuDispatcher(struct CPxSceneDesc*, struct CPxCpuDispatcher*);
*/ */
import "C" import "C"
import "unsafe"
type PvdInstrumentationFlag uint32 type PvdInstrumentationFlag uint32
@ -91,11 +90,9 @@ func (p *PvdTransport) Release() {
func DefaultPvdSocketTransportCreate(host string, port, timeoutMillis int) *PvdTransport { func DefaultPvdSocketTransportCreate(host string, port, timeoutMillis int) *PvdTransport {
hostCStr := C.CString(host) //This CString should NOT be freed because its stored internally. If this is freed connection to PVD will fail
defer C.free(unsafe.Pointer(hostCStr))
p := &PvdTransport{} p := &PvdTransport{}
p.cPvdTr = C.CPxDefaultPvdSocketTransportCreate(hostCStr, C.int(port), C.int(timeoutMillis)) p.cPvdTr = C.CPxDefaultPvdSocketTransportCreate(C.CString(host), C.int(port), C.int(timeoutMillis))
return p return p
} }