新增动态链接库调用

This commit is contained in:
2025-03-21 22:33:07 +08:00
parent ded0148ba6
commit e3490fa5b1
4 changed files with 34 additions and 4 deletions

29
mainDLL.go Normal file
View File

@@ -0,0 +1,29 @@
package main
/*
#include <stdlib.h>
*/
import "C"
import (
"ShotRDP/client"
"unsafe"
)
//export GetScreen
func GetScreen(host *C.char, data **C.char, length *C.int) *C.char {
imgBytes, err := client.RealGetScreen(C.GoString(host))
if err != nil {
return C.CString(err.Error())
}
*data = (*C.char)(C.CBytes(imgBytes))
*length = C.int(len(imgBytes))
return nil
}
//export Free
func Free(p *C.char) {
C.free(unsafe.Pointer(p))
}
func main() {}