In short: Today I found that when a DLL is built without precompiled headers, a strange error shows when you try to use it.
Building a dll goes fine when precompiled headers are disabled. However, as soon as the DLL is connected (either compile time or runtime), this leads to an "Invalid parameter" error. Actual error codes are different for both cases. When setting the compilation time, a dialog box appears with error code 0xc000000d, when called, LoadLibrary()it returns a pointer NULLand GetLastError()returns 0x57.
edits:
I found that the problem disappears when incremental binding is disabled. Somehow I missed the following error that Visual Studio showed when starting a client that connects to the compilation time of the DLL:
'TestClient.exe': Loaded 'D:\Projects\PchDllTest2\Debug\TestClient.exe', Symbols loaded.
'TestClient.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', Cannot find or open the PDB file
'TestClient.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', Cannot find or open the PDB file
'TestClient.exe': Loaded 'D:\Projects\PchDllTest2\Debug\TestDll.dll', Symbols loaded.
SXS: RtlCreateActivationContext() failed 0xc000000d
LDR: LdrpWalkImportDescriptor() failed to probe D:\Projects\PchDllTest2\Debug\TestDll.dll for its manifest, ntstatus 0xc000000d
Debugger:: An unhandled non-continuable exception was thrown during process load
The program '[5292] TestClient.exe: Native' has exited with code -1073741811 (0xc000000d).
As requested by function declaration:
#ifdef __cplusplus
extern "C" {
#endif
MYTEST_API int MyTestFoo(int a);
#ifdef __cplusplus
}
#endif
This is great: when you create a new DLL using the wizard (New project → Visual C ++ → Win32 → Win32 Project), the wizard forces you to use precompiled headers when choosing a DLL as the application type. See answer from ta.speot.is.
I drastically changed this question as it looked first, as if I thought it was somehow registered that PCH is required for DLL projects. This is not the case, it is probably a strange kind of mistake (let's hope it is not) or, probably, I am doing something very stupid ...