#1510 Fantom requires MSVCR71.dll

dsav Wed 27 Apr 2011

I downloaded 1.0.58 build from the main page. But fan.exe fails to run because my home computer (Windows 7) lacks MSVCR71.dll. Is it a bug? If not, where to get this lib?

brian Wed 27 Apr 2011

It it the std C lib when you use Microsoft Visual C compiler. The whole missing/conflicting/redistribution of the MS lib is a huge pain in the ass. It typically comes with just about anything compiled with Visual C/C++ (which is most Window's product). I tried to do a quick search on microsoft.com but it isn't obvious how to easily download it from there.

Also you can easily run Fan straight with java.exe:

java.exe -cp %fan_home%\lib\java\sys.jar -Dfan.home=%fan_home% fanx.tools.Fan

danielm Fri 29 Apr 2011

It's a big pain with VS 8/9/10, but things weren't too bad with VS 7.1. You can either:

1) Include MSVCR71.dll in your bin folder. This is what most software does, including Java.

OR

2) Compile with /MT instead of /MD. This will statically link the CRT, so you don't need the CRT DLL anymore. I usually find this option easier if just building a few small EXEs.

tonsky Fri 6 May 2011

I just want to report a workaround for this case (which I encounter on a fresh installed Windows 7 with JDK installed):

I've copied msvcr71.dll from jre/bin to fantom/bin and got it fixed.

I think this file should be included to fan distro.

SlimerDude Thu 8 Mar 2012

I thought this topic was worth bumping because I've just encountered it on a clean XP machine.

A good article on what it's all about is here Java 6 and msvcr71.dll

Essentially it seems to be Sun's, um, I mean Oracle's fault. As suggested above, downloading and copying msvcr71.dll into the fantom/bin/ dir is the easiest fix.

KevinKelley Thu 8 Mar 2012

The needed dll can sometimes be found in the jvm's bin dir, no need to download.

It's changed over time... Depending on jre version, it may have msvcr71.dll, msvcrt.dll, msvcr100.dll... those are the ones I've found.

Bypassing the fan launcher, invoking with

java -cp path/to/sys.jar fanx.tools.Fan mypod

avoids the need for the dll.

brian Thu 8 Mar 2012

However you cut, it boils down to getting a nice JVM launcher on Window's sucks. It sucks because Batch files are such as crappy scripting environment (not that I love Bash, but at least you do reasonably complicated stuff). Then add in the nightmare which is Window's Service architecture and insane complexity to run a process as daemon.

I don't really like the current launcher design requiring C code for Windows which missing DLL problems, no service support, and 32-bit vs 64-bit switching. I'd like to see if we could potentially switch to a simpler model and use batch files or I've also been wondering if we could use Powershell which I understand is built-in to all version of Windows these days.

MarcelM Wed 22 Aug 2012

I've had the same with msvcr100.dll. It was missing too and I copied it from jre\bin to fantom-1.0.63\bin. Now I can start. (google brought me here, that's why I like to add this)

danielm Thu 23 Aug 2012

@Brian There is a fairly easy way to resolve this issue in the Fantom launcher: you need to make an attempt to load the MSVCRT DLL before loading the JVM DLL. This can be done either by guessing the location of the MSVCRT DLL and/or by simply adding the JVM's bin folder to the DLL search path with the SetDllDirectory() Windows API function.

For an example, see the VM::LoadRuntimeLibrary() function in the WinRun4J source code:

https://github.com/poidasmith/winrun4j/blob/master/WinRun4J/src/java/VM.cpp

WinRun4J is my current favorite Java launcher on Windows (I have tried many, including writing my own). Perhaps there is some way to integrate WinRun4J into the Fantom launcher, as it supports many vital Windows features, such as native services.

brian Thu 23 Aug 2012

On most systems excepting fresh installs, it seems to be in Window's system path, so not sure that would help much. I think most of the time when its not available it isn't on the system at all. For next build I just added it to bin - I hate doing that since its like 300KB - but what's another 300KB.

What I really want to do is maybe switch over to use powershell or something. It is amazing what a pain in the ass Java on Windows is - both to just run a program like normal users would do and to run a Java program as a Window's service.

Login or Signup to reply.