12-13-2010 12:23 PM
I have seen that CVI 8.1 has "External Compiler Support" and even several questions indicating that users have done this. But I find that the instructions on how to do this are vague. There is nothing quite like a real life example.
I've already seen that in the Options --> Build Option dialog, I need to select compatibility with Visual C/C++ and the compiler for the release configuration is vc2005. But then there is a list of compiler defines. I understand that there are typically many others than just /DWIN32_LEAN_AND_MEAN. What are they? How do I know? Do I need WINVER? Am I going to need to include some specific headers?
In the Build --> "External Compiler Support" the UIR Callbacks has several options, but no explanation of what this is about. The Help page is clearly written under the assumption that the user has done this before and the Help page is just some brief reminders. If I select None, does that mean no UIR? If I select Source, do I have to supply it? Same with Object. Some of the documentation seems to indicate that using LoadExternalModule isn't really an option. So why is there a checkbox? If I check it, what do I need for the Other Symbols?
How do I build the Debug version with the external compiler?
How do I force the linker to produce a .PDB file (which is really the whole point of this exercise)? Even in the release version?
I do I suppress boring error messages? Using #pragma?
Sorry to be so long winded, but there's nothing quite like a working example. Something as simple as a textbox with "Hello, World!" and a button would be very helpful.
Thanks for your help!
-- Harold Bamford
12-14-2010 04:52 PM
Hi HaroldB,
In regards to specifying specific headers that is based on the external comiler you are using so you would need to see what VS2005 requires.
In reference to building a Debug version this unfortunately not possible when building an external compiler.
Can you please explain a little bit more on what you mean by forcing the linker to produce a .PDB file?
Also, #pragma may be a reasonable option for suppressing some error messages.
12-14-2010 05:19 PM
@Hassan A wrote:
Can you please explain a little bit more on what you mean by forcing the linker to produce a .PDB file?
I am making CVI programs that use a DLL produced by Visual Studio 2005. In that DLL, I can often detect terrible situations and as part of the error reporting, I produce a minidump (.dmp) to be used with WinDbg or other debugger. Mostly to get a usable stacktrace and check variable values.
However, the resulting .dmp file is unusable as there is no program database (.PDB) for the CVI application. I figured I would use VS2005 as the external compiler and remove the "/c" flag so that Visual Studio would perform the link. And I would pass other flags to force a .PDB file to be generated.
It turns out that this is extremely awkward. Apparently the call to the compiler is in a temp file with a temporary filename as the .c to compile.
I wish I could get access to the code that does this, but I know how likely that is.
12-15-2010 06:15 AM
It seems to me that your best bet would be to transfer the CVI project completely into VS2005. Assuming the compatability of VS2005 with CVI8.1, CVI should have installed a 'LabWindows/CVI conversion' project wizard within VS to enable you to do this easily.
12-15-2010 09:46 AM
@msaxon wrote:
It seems to me that your best bet would be to transfer the CVI project completely into VS2005. Assuming the compatability of VS2005 with CVI8.1, CVI should have installed a 'LabWindows/CVI conversion' project wizard within VS to enable you to do this easily.
That actually sounds reasonable for you and me, but the other developers here really like the CVI interface. So, I am trying to get a method of making a minidump workable without major efforts on their parts. I'm afraid that complete conversion to VS2005 would be over the limit.
I originally tried this external compiler support to get the .pdb file (required to make use of the minidump) because I saw that .pdb files were available from National Instruments. How do they generate them? Ideas?
12-15-2010 10:00 AM
Hey Harold -
Unfortunately, there is no way to prevent CVI from doing the final link on your project. The external compiler support was intended only to allow customers to use an optimizing third party compiler for release builds for the generation of optimized code. Unfortunately, this also means that as long as you are building your projects in the CVI environment, you will not be able to generate a .pdb file for crash dump analysis.
I'm not sure what you mean by ".pdb files were available from National Instruments", but many of our products are actually written to some extent in Visual Studio, so we are able to generate pdb files.
NickB
National Instruments
12-15-2010 12:19 PM
@nickb wrote:
Hey Harold -
Unfortunately, there is no way to prevent CVI from doing the final link on your project. The external compiler support was intended only to allow customers to use an optimizing third party compiler for release builds for the generation of optimized code. Unfortunately, this also means that as long as you are building your projects in the CVI environment, you will not be able to generate a .pdb file for crash dump analysis.
I'm not sure what you mean by ".pdb files were available from National Instruments", but many of our products are actually written to some extent in Visual Studio, so we are able to generate pdb files.
NickB
National Instruments
Actually, I found the removing the "/c" flag caused the VS2005 linker to be invoked. It does seem that the CVI linker also runs. That isn't a problem if the .pdb file gets generated AND the CVI linker runs successfully.
Where can I find the .pdb files that you do have? Is there a server site usable by WinDbg or can I download them?