Go uses static link library compilation to generate executable files. A third party files are used, no source code construction

Time:2019-11-24

Both go build and go install need to be compiled using source code. But sometimes we only have. A or. So files. We can’t get the source code of the third-party library. At this time, we need to compile the static link library;

Above is the file distribution before the experiment.

To compile a command using a static link library:

➜  src go tool compile -I ../pkg/darwin_amd64/  callyx.go 
➜  src go tool link -o call2 -L ../pkg/darwin_amd64/ callyx.o

Post experiment file distribution:

As we can see from the figure, the executable is generated.

Resources come from the network. If it helps you, please pay attention to cnblogs.com/xuyaowen

 

Recommended Today

How to share queues with hypertools 2.5

Share queue with swote To realize asynchronous IO between processes, the general idea is to use redis queue. Based on the development of swote, the queue can also be realized through high-performance shared memory table. Copy the code from the HTTP tutorial on swoole’s official website, and configure four worker processes to simulate multiple producers […]