コード例 #1
0
ファイル: easy.go プロジェクト: edmonds/golang-curl
func EasyInit() (easy *Easy, err *CurlError) {
	easy = new(Easy)
	if easy.cptr = C.curl_easy_init(); easy.cptr == nil {
		return nil, NewError(E_FAILED_INIT)
	}
	easy.cerrbuf = (*C.char)(C.malloc(C.CURL_ERROR_SIZE))
	err = NewError(C.my_esetoptc(easy.cptr, C.CURLOPT_ERRORBUFFER, easy.cerrbuf))
	if err != nil {
		C.curl_easy_cleanup(easy.cptr)
		return nil, err
	}
	runtime.SetFinalizer(easy, func(e *Easy) { e.Cleanup() })
	return
}
コード例 #2
0
ファイル: easy.go プロジェクト: ym/go-curl
// curl_easy_init - Start a libcurl easy session
func EasyInit() *CURL {
	p := C.curl_easy_init()
	return &CURL{handle: p, mallocAllocs: make([]*C.char, 0)} // other field defaults to nil
}
コード例 #3
0
ファイル: easy.go プロジェクト: andelf/go-curl
// curl_easy_init - Start a libcurl easy session
func EasyInit() *CURL {
	p := C.curl_easy_init()
	c := &CURL{handle: p, mallocAllocs: make([]*C.char, 0)} // other field defaults to nil
	context_map.Set(uintptr(p), c)
	return c
}
コード例 #4
0
ファイル: easy.go プロジェクト: rli-diraryi/go-curl
// curl_easy_init - Start a libcurl easy session
func EasyInit() *CURL {
	p := C.curl_easy_init()
	return &CURL{handle: p} // other field defaults to nil
}