Fred,
I see you got no replies. I am trying this as well. I have found that the Crun library is not replaceable so that is a show-stopper for using the Sun compilers. I am moving on to try the g++ compiler. I do not use exceptions, RTTI, or templates in my code so I have some (faint) hope of success. Good luck.
Larry
> Is it possible to load kernel modules into Solaris
> that contain C++ code? If so, what compile/linker
> options are required to make this happen?
Hello.
Yes. The kernel modules are independent of programming language as long as the object file format is correct. So C++ will work.
There are two kinds of problems:
1) The _init, _fini and _info functions must have the same name as in other programming languages. This is a problem in C++ because C++ adds data type information to symbol names in the object files. This means a function named "int x(int)" would have the symbol name "_x" when using C/x86 or just "x" when using C/Sparc while it may have a symbol name like "1_xII" when using C++ (the actual symbol name depends on the C++ compiler used).
To solve this problem you may use the 'extern "C"' statement or write a simple assembler wrapper function.
2) Normally C++ requires a large run-time library. One example for this is the "new" operator. You'll have to write a replacement for this run-time library. So if you want to use the "new" operator you'll have to provide a function named "operator new(int size)" (or something like that). This is true for ALL C++ operators (delete, new[], delete[], ...).
Martin