I'm trying to write a mixed-mode DLL, let's call it 'Client', to replace some unmanaged classes with their managed equivalents. Everything works fine on my personal machine, but when I check the source code in, our build machine won't build the project. It doesn't recognize the Managed classes I'm using from another DLL, called 'Core.'
I think the issue has to do with precompiled headers. Here's why:
To use the classes from 'Core', I added a reference to the 'Core' project in the 'Client' Project. If I remove this reference and then build the project on my personal machine, it still works. The CLR PCH doesn't recompile after removing the reference, though. If I recompile the CLR PCH, and then compile the project, it fails with the same errors that I get on the build machine: the managed classes are not recognized.
It seems to me that the managed classes from DLL's you import are defined in the precompiled header. I haven't been able to verify this, but that's the best guess I have. Does anyone have any insight they can shed on this issue? Are project references in Mixed DLL's resolved by putting hooks into the managed PCH?
Steps to Reproduce
The following makes no sense to me:
- Get Client to build.
- Remove the Reference from Client to Core. Compile Client. Client STILL builds. This is not expected.
- Recompile the Client PCH, then compile Client. Compile Client fails: the classes in 'Core' are undefined. This is expected behavior.
- Add Reference to Core, compile. Compile Client fails for the same reason. This is not expected
- Recompile the Client PCH, then compile Client. Client compiles fine.
My conclusion from this experiment is that the References are inserted into the project via precompiled headers, and that something is broken with the way this works, at least on our build machine.