Exemple #1
0
func NewProblem() *Problem {
	cProblem := C.problem_new()
	problem := &Problem{cProblem}

	runtime.SetFinalizer(problem, func(p *Problem) {
		C.problem_free(p.problem)
	})

	return problem
}
Exemple #2
0
func newProblem() *C.problem_t {
	problem := tryNew(func() unsafe.Pointer {
		return unsafe.Pointer(C.problem_new())
	})
	return (*C.problem_t)(problem)
}