
On 9/18/06, Robert Ramey <ramey@rrsd.com> wrote:
Note that the only reason for using __declspec on tis platform is that without it, programs compiled in release mode will optimize away code not explicitly referred to. This breaks serialization of derived pointers. So this is a hack to work around over-zealous compiler optimizaton. This has been learned through painful and time consuming experience. It is possible this solution is overkill in some cases, but there is no way to know without investing a lot more effort.
If you have the time, could you explain to me exactly what the problem is (or show me a program highlighting the problem)? How can the code be needed for serialization if it isn't actually "used" from the compiler's point of view?
I have no idea if the serialization library will work with /clr. My intuition tells me I doubt it. If I had to do this I would consider using SWIG which I have used in another context (not using serialization) to integrate Boost components into .NET languages.
It definitely won't if you use dllexport, but there shouldn't be any reason why it can't work apart from that.