The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

bminer1 (14) [Avatar] Offline
#1
Excellent book. But I'm still unclear on the exact project property changes I need to make to start building an existing unmanaged C++ application with /clr. I have a bunch of C++ files compiled into a set of DLLs and an EXE. Must all the .cpp files in all of the DLLs and the EXE be compiled and linked with /clr? I tried compiling just the main executable with /clr and it crashed immediately with a System.BadImageFormatException. I set project settings you mentioned in 7.2.1. Thanks.
bminer1 (14) [Avatar] Offline
#2
Re: Project properties when starting to use /clr ?
Just to be clear, the application linked fine with /clr. It crashes when I run it. The output shows various DLLs being loaded and then the exception. mscorlib.dll and msctf.dll are the last 2 dlls loaded before the exception.
Nish (16) [Avatar] Offline
#3
Re: Project properties when starting to use /clr ?
>> Must all the .cpp files in all of the DLLs and the EXE be compiled and linked with /clr? <<

No. In fact, even within a project you can selectively turn on/off /clr for individual cpp files.
Nish (16) [Avatar] Offline
#4
Re: Project properties when starting to use /clr ?
>> The output shows various DLLs being loaded and then the exception. mscorlib.dll and msctf.dll are the last 2 dlls loaded before the exception. <<

What does the call stack say?
bminer1 (14) [Avatar] Offline
#5
Re: Project properties when starting to use /clr ?
Sorry, I didn't grab the call stack and I've moved onto other approaches that seem to be working (the mixed mode extension DLL approach).