|
|
Templates may be used within device drivers, but with care. The issue here is that the C++ template prelinker is not run on links within the idbuild command that relinks the kernel with the driver. So, any necessary template instantiations must be compiled into the driver's .o file that is passed to idbuild.
If the driver consists of just one C++ source file, use the CC -Tused compiler option to include the template instantiations. If the driver contains multiple source files and instantiations must be correctly assigned to individual object files, on SVR5, the template prelinker can be run manually with the CC -Tprelink_objects compile option, before coalescing them with the ld -r command.