Hi,
I was building a .dll file using Visual Studio Compiler and Linker on Windows Vista.
When I want to load this .ma/.dll on a XP machine the following error is prompted:
OS could not load: .../...dl , error 126.
I checked the V8i version, its 8.11.05.17 on both maschines.
Any suggestions?
Thanks,
Stefan.
When MicroStation attempts to load your DLL it calls on the operating system to find the file. Windows follows a published algorithm when searching for files. If Windows fails to find your DLL it returns error code 126, which it passes back to MicroStation.
MDL applications, and DLL that implement those applications, should be in one of the paths specified by configuration variable MS_MDLAPPS. By default, that points to \MicroStation\mdlapps.
You can instruct Visual Studio to build your DLL in that folder. Our article tells you how.
Regards, Jon Summers LA Solutions
Hi Jon,
the dll resides in mdlapps foldes.
How about the C run-time libraries? When Windows attempts to load a DLL, it also must load any dependencies. If it can't find those, it passes the same error code up the chain. Those libs exist on your development computer, because they are part of Viz Studio.
However, they don't necessarily exist on the target computer. Look in the \redist folder of your Viz Studio installation to find redistributable files that should be installed on a target computer. You can also obtain a redistributable executable from Microsoft that you run to install the C run-time libs.
Stefan, you can try to use Dependency walker to check missing DLLs. If your DLL is 32bit, use 32bit version of Dependency walker.
Dan
It would help to know the version of Visual Studio that you are building with. MicroStation recomends using VisualStudio 2005 for Native Code dlls.
HTH,
mark anderson [Bentley]
Visit me at https://communities.bentley.com/communities/other_communities/bentley_innovation/default.aspx
I just wanted to inform you, that I solved the issue with your help.
I used Dependency Walker to examine the dll.
Then I copied the missing dlls (msvcp90.dll, msvcr90.dll) into the mdlapps folder.
Thanks, Stefan.
Unknown said:Then I copied the missing dlls (msvcp90.dll, msvcr90.dll) into the mdlapps folder.
That is not safe!
You should install redist on destination computer instead of copying those files directly. There may be another msvc90 dependent application which needs different version of libraries. This way, your dlls will be the first in load order which may do problems to others. Yes, there are manifests to handle it, but my experiences are, that you should always install redist and embed correct manifest (manifest is embedded by VS).
Unknown said: I copied the missing dlls (msvcp90.dll, msvcr90.dll)
You're building with Viz Studio 2008. Bentley Systems recommend Viz Studio 2005.
Certainly, if you use MFC dialogs, you will have problems. There may be other issues.
And follow Dan's advice. Use the Microsoft redistribution libraries and deliver them to the correct location. Make sure that your Viz Studio project embeds a manifest that tells the operating system which run-time libraries it is using (it does that by default).