Реализацию шаблонных методов / функций нельзя выносить в отдельный translation unit
template <typename T>
class Q
{
T t;
void f(T);
};
#include "q.h"
template <typename T> void Q<T>::f(T v)
{
t += v;
}
template class Q<int>;
$ g++ q.cpp -g -c -o q.o
$ objdump --demangle -d q.o
q.o: file format elf64-x86-64
Disassembly of section .text._ZN1QIiE1fEi:
0000000000000000 <Q<int>::f(int)>:
0: 55 push %rbp
1: 48 89 e5 mov %rsp,%rbp
4: 48 89 7d f8 mov %rdi,-0x8(%rbp)
8: 89 75 f4 mov %esi,-0xc(%rbp)
b: 48 8b 45 f8 mov -0x8(%rbp),%rax
f: 8b 00 mov (%rax),%eax
11: 89 c2 mov %eax,%edx
13: 03 55 f4 add -0xc(%rbp),%edx
16: 48 8b 45 f8 mov -0x8(%rbp),%rax
1a: 89 10 mov %edx,(%rax)
1c: 5d pop %rbp
1d: c3 retq
у других topic станет невалидным
но это не делает их вместе производной работой?
However, copyright law obviously
hinges on the definition of «derived work», and as such anything can
always be argued on that point.
I personally consider anything a «derived work» that needs special hooks
in the kernel to function with Linux (ie it is _not_ acceptable to make a
small piece of GPL-code as a hook for the larger piece), as that obviously
implies that the bigger module needs «help» from the main kernel.
Similarly, I consider anything that has intimate knowledge about kernel
internals to be a derived work.
What is left in the gray area tends to be clearly separate modules: code
that had a life outside Linux from the beginning, and that do something
self-containted that doesn't really have any impact on the rest of the
kernel. A device driver that was originally written for something else,
and that doesn't need any but the standard UNIX read/write kind of
interfaces, for example.
Суть в наличии исключений из GPL. Без них нет способа проприетарному коду использовать GPL код
The «user program» exception is not an exception at all, for example, it's
just a more clearly stated limitation on the «derived work» issue. If you
use standard UNIX system calls (with accepted Linux extensions), your
program obviously doesn't «derive» from the kernel itself.
Только во время выполнения гостевой системы KVM ни при чём, если архитектура гостевой системы отличается от архитектуры хостовой. С практической точки зрения — будет тормозить.