A library function is a collection of APIs used when a program is running, such as GNU C library (also known as glibc). We all know that library functions generally realize some basic functions. Using library functions can not only improve the running efficiency of programs, but also improve the quality of programming. But if a library uses the GPL protocol, will your program be infected if you use this library in your program? There are different views on this issue. The Free Software Foundation (FSF) thinks that your program will be infected in this case. As long as you link to the GPL library, your whole program must be open source when it is distributed, otherwise you can't use this library.
However, as we have said, library functions are basic and bottom-level functions. If the GPL protocol is used, it will restrict the use of this library function by patent programs, which is not conducive to the promotion of free software. So we put forward GNU Lesser General Public License (LGPL), which is mainly used in function libraries. Its biggest feature is that it allows non-free software to link to function libraries without being infected.
Therefore, according to the Free Software Foundation, programs linked to the GPL library must be open source, while programs linked to the LGPL library need not be open source.
In the description of FSF, there is a separate description of software aggregation, mainly to distinguish whether these programs are independent programs or different parts of the same program. For example, FSF thinks that it can be judged from the communication mechanism between programs (exec, pipes, rpc, * * function call with address space, etc. ) and the semantics of communication (what information is exchanged).
If your program is packaged in an executable file, it must be a program, and the whole program must conform to GPL. However, if the communication between programs is based on pipes, sockets and command line parameters, these programs can basically be judged as independent programs, and different programs can abide by different protocols. If the data structure exchanged between programs is particularly complex and the semantics are very close, it can generally be considered as the same program.
However, FSF also stressed that this is ultimately a legal issue, which should be decided by the judge to judge whether the aggregation procedure is separate or the same big procedure.
Linux uses GPL protocol, so will the program transplanted to Linux be infected by GPL? In fact, whether your program is affected by GPL has nothing to do with your underlying operating system. Mainly depends on the first item we mentioned above, which protocol you use. If your program doesn't use Linux libraries at all or only uses LGPL libraries, it won't be infected. If it uses GPL library, it will be infected by GPL. According to FSF, the libraries published by GPL are generally very professional libraries, which are not available on other platforms. Since Linux is exclusive, there is no problem with open source.
MySQL uses dual-protocol authorization, and the community version uses GPLv2. Taking Java development as an example, the communication mode between the program and the database is socket. According to what I said earlier in this article, our Java programs will not be infected by MySQL, and we don't have to abide by GPL. But there is a problem. The drivers we use are all provided by Oracle in the GPL protocol. We did put these drivers in a package, so our program was infected by this driver. When you sell your program, you must give the source code to the other party at the same time.
But in reality, we seldom hear that using Mysql requires open source code. After searching online, there are all kinds of opinions, and most people basically ignore this problem. I think the most convincing reason for open source is that "Java provides JDBC, and MySQL driver is only an implementation of JDBC API, which can be replaced and is not a necessary part of the program".
On this issue, there are still considerable differences on the Internet. So far, there is no authoritative statement, and there is no corresponding precedent. Of course, if your program is not for distribution, there is absolutely no need to entangle this issue. In the final analysis, this is a legal issue.
The infectivity of GPL ensures the open source of programs and the freedom of most programmers to use programs, but it also limits the freedom of some patented programs to use GPL software. If it is in some very clear cases, it is necessary to open the corresponding program according to GPL, but if it is in some ambiguous cases, it is required to open the source code, so let the judge judge.