Archive: exdll plugin made with MSVC9 does not work on W98


exdll plugin made with MSVC9 does not work on W98
I have been using a simple plug-in DLL with NSIS for years. It displays a simple dialog box, accepts passwords, makes some checks on registry entries (plus some other 'magic'). If I compile the DLL using MSVC5 (1997) the installation program works on all Windows OS including W98 and even W95. But if I re-compile the DLL using the upgraded (sic) MSVC9 (2008) the installation program will not work on W98.

I've searched google and tried every phrase I can think of in the WinAmp search options.

I can make DLLs and executables using MSVC9 that work perfectly OK on W98. I have set the compiler not to use Unicode, use the /MT option so it doesn't require the C run time, even fixed the DLL executable with Legacy Extender so it fixes the MSVC9 "feature" that stops executables working on W95 variants. These settings will make an executable that works on W98. But if I incorporate the DLL into a NSIS installer, it locks up the W98 system as soon as any call is made using *any* MyDLL::MyFunc-style command, with or without a dialog. The plug-in DLL is made using the proper exdll.c/h files provided. I have NSIS 2.38.

Anyone else had this problem on W98 or know the correct settings for MSVC9? I know I could use another compiler, but I'd like to make this work with MSVC9, if possible.


Have you tried running dumpbin.exe on the DLL and looking for anything funny? Probably one of the /RTC options need to be disabled, or just all of them with /GZ-.


I've used CFF Explorer and there's nothing obviously amiss. I write many DLLs using MSVC9 that work very well on W98. I'd like to think I know all the settings and fixes to do. It's the distribution of these programs to end users on W98 that worries me.

Since writing the first post, I've done some more tests using the provided exdll.c/h files and a simple test script:

Name "Test exdll plug in"
!addplugindir "."
outfile testexdll.exe
Section Test
StrCpy $0 "Hello world"
DetailPrint "About to call myFunction: $0"
exdll::myFunction
SectionEnd

1. If I compile exdll.dll (using simpler, old 2003 versions of the source code) using MSVC5, it will work OK on W98.

2. If I compile exdll.dll using Pelles C, it will work but then give me a GPF error before exiting.

3. If I compile using MSVC9 without using Legacy Extender, it gives an error message that the DLL could not be loaded.

4. If I use Legacy Extender on exdll.dll, it hangs in W98 immediately the first call is made to exdll:MyFunction.

Then I downloaded the latest version of NSIS (2.45). This includes an MSVC2008 (=MSVC9) project file (but oh joy, now we have to include a .lib file, so we can't even compile it on anything else -- not a clever move, guys!).

5. I compile the new exdll source using MSVC9, remake the script, but get the same error as in (3) above on W98.

6. If I recompile the test NSIS script using the original exdll.dll made in (1) using the latest NSIS, it works OK in W98.

I'd very much like to continue using NSIS to distribute my programs to end users who may well still be using W98. Our friends at MS do not seem to be making this easy. I know the world moves on, but there are still customers out there!


What does Dependency Walker say when profiling the loading process?


Solved it. And of course I was the culprit. There are *two* changes you have to make in MSVC9 to use Legacy Extender and I'd missed out one. Hence the system crash in W98. My punishment has been to waste the last 24 hours trying to fix it. They are setting up the flogging frame already.

Thanks to kichik for the suggestions and, of course, to the guys at NSIS for a great tool. Here's what I've learned to make sure it works on legacy W98 systems (and presumably W95 and WMe, too):

1. If you want to use a plug-in DLL with your installation then either:

(a) Compile the DLL with MSVC6 or earlier (don't know about MSVC7); or

(b) Compile with MSVC8 (VS2005+) or above but then use Cloanto's Legacy Extender to "fix" the DLL (http://www.legacyextender.com/)

2. Read their Project Configuration instructions properly! If you don't make the Legacy Extender fixes, you will just get a message that temp\xxx.DLL did not work.

3. The old 2003 exdll.c/h files still work perfectly well on all systems. You don't need to use the complications of pluginapi.lib, etc.

If anyone knows the settings to make a DLL compatible with both NSIS and W98 using Pelles C or MinGW, I'm sure we'd all be grateful to hear.