Writing A Notes C-API Program in Visual Studio Express, Part 2 (Saturday, Oct 21)
Okay, so I've been playing around with writing a Notes C-API program in Visual Studio Express, and I ran into a problem. I compiled up SoapLog and people downloaded and tested it, and for some people it ran just fine but for others (notably Bruce) it would give a generic "Error loading DSAPI filter" and wouldn't work.
Naturally, it worked just fine for me.
After much investigation, I found out that it was a runtime DLL dependency issue. It appears that by default non-.NET applications compiled in Visual C++ 2005 require MSVCR80.DLL. This file should be in the directory (get this):
C:WINDOWSWinSxSx86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_0de06acd
On most Windows XP and Windows 2003 installations the file seems to be there. However, it's not there by default on Windows 2000. If the program that you've compiled is an EXE, you'll get an obvious error that you're missing a dependent file and you can figure out how to fix it. If it's a DLL like mine, you may get a very generic error that is difficult to troubleshoot (or it may just fail silently).
One option is to have the users download the Microsoft Visual C++ 2005 Redistributable Package (only a 2.6 MB download) and install it. That will give them MSVCR80.DLL, MSVCM80.DLL, and MCVCP80.DLL and your VC++ apps should run happily.
Another option is to compile the program with the /MT option instead of the /MD option, which will make the compiled program much bigger (74.5 KB versus 14.5 KB for me) but will remove the dependency. Compiling with /MD on Visual Studio 6 wasn't a problem because it would make your program rely on MSVCRT.DLL and MSVCP60.DLL, which virtually every Windows machine in the world already has these days. VS2005 changed this dependency to MSVCR80.DLL, which isn't quite as ubiquitous.
A third possibility is to create an installer package for your application that automatically installs the redistributable files if they're not there.
In my case it was easiest just to compile with /MT and be done with it. From a percentage standpoint, the final program is much bigger (~400% bigger), but in real terms it's still only a 75KB file.
So if SoapLog didn't work for you before, please download the 1.0.2 version and try again!
[ permalink ] [ e-mail me ] [ read/add comments ]





