mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-14 12:23:43 +00:00
feat: direct call download api by cgo dart
This commit is contained in:
1 parent
467ada5500
commit
91dfd78b77
71 files changed
+6936
-1883
No files matched your search
@@ -1,15 +1,11 @@
|
||||
package main
|
||||
|
||||
/*
|
||||
#include <stdlib.h>
|
||||
*/
|
||||
import "C"
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/GopeedLab/gopeed/bind"
|
||||
"github.com/GopeedLab/gopeed/pkg/api"
|
||||
"github.com/GopeedLab/gopeed/pkg/api/model"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func main() {}
|
||||
@@ -20,7 +16,6 @@ func Create(cfg *C.char) *C.char {
|
||||
if err := json.Unmarshal([]byte(C.GoString(cfg)), &config); err != nil {
|
||||
return C.CString(bind.BuildResult(err))
|
||||
}
|
||||
defer C.free(unsafe.Pointer(cfg))
|
||||
|
||||
return C.CString(bind.Create(&config))
|
||||
}
|
||||
@@ -31,7 +26,6 @@ func Invoke(index int, req *C.char) *C.char {
|
||||
if err := json.Unmarshal([]byte(C.GoString(req)), &request); err != nil {
|
||||
return C.CString(bind.BuildResult(err))
|
||||
}
|
||||
defer C.free(unsafe.Pointer(req))
|
||||
|
||||
return C.CString(bind.Invoke(index, &request))
|
||||
}
|
||||
Reference in new issue
Block a user