EasyNTS can not be compiled under Go1.15 version under linux problem optimization

As a video cloud gateway developed by TSINGSEE Qingxi Video, the main function of EasyNTS is to solve the needs of remote video sharing/networking. When the web page adds mapping to the domain name, an external network access address will be generated after the addition is successful. In the browser Enter the access address of the external network, and you can view the internal network application; without opening the port, the EasyNTS cloud gateway platform will send the port networking command to the EasyNTS hardware, and the networking is successful in a short time, and then the cloud capability will be released to the outside world.

NTS.png

At present, the developer upgrades the Goalng version of EasyNTS to version 1.15, and finds that a compilation error occurs under Linux.

image.png

Check the corresponding code as follows. The last sentence reports an error. It should be that Go1.15 has stricter checks on some Cgo, so the above compilation problem occurs.

chandle := (*C.Easy_Handle)(C.malloc(C.sizeof_Easy_Handle))
defer C.free(unsafe.Pointer(chandle))
C.memset(unsafe.Pointer(chandle), 0, C.sizeof_Easy_Handle)
r1 := C.EasyStreamClient_Init(chandle, C.int(0))

Modify the code as follows:

chandle := (*C.Easy_Handle)(C.malloc(C.sizeof_Easy_Handle))
defer C.free(unsafe.Pointer(chandle))
C.memset(unsafe.Pointer(chandle), 0, C.sizeof_Easy_Handle)
r1 := C.EasyStreamClient_Init((*unsafe.Pointer)(chandle), C.int(0))

After the last sentence is modified, the error disappears and the compilation can be done normally.

image.png

We have solved penetration and networking problems through EasyNTS in many projects, such as smart construction sites, smart communities, etc. If you are interested, please follow us to learn more.

NTS.png

Guess you like

Origin blog.csdn.net/EasyNTS/article/details/120001635