Solved

Cannot load library error 126

Posted on 2011-03-21
7
2,709 Views
Last Modified: 2013-11-27
Hi all!

 

I have a big problem.

I developed a DLL file for MetaTrader via Visual Studio Express 2010 C++.

Metatrader is a forex trading program which is programmable and can use any DLL file by import function.

I have used the VS express on Windows 7 x64 op system.

The express can not use x64 (as I know) so everything is built as x86 (32bit), I have checked it via Properties (management).

The problem: I built DLL file on my machine and it is working perfectly under MetaTrader but only on my machine. (perhaps VS copied some needed files)

When I tried it on other machine (WIn XP (x86)) then I got an error message: cannot load library error 126

Dependency Walker shows the following DLLs are missing (only on WIN XP machine):

 

WER.DLL

NCRYPT.DLL

BCRYPT.DLL

IESHIMS.DLL

I downloaded them and put to experts/libraries (next to my dll file).

(metatrader can find any DLL which copied to this 'libraries' )

The problem still exists.

I changed the Use of MFC from shared to static in VS and rebuilt the DLL.

VS settings:

Properties/Configuration Properties/General/Use of MFC=Use MFC in a Static Library
Properties/C++/Code Generation/Runtime Library=(/MDd)

I set these ones what I gathered of forums, etc...

The problem still exists. (DLL files are missing further)

I think it is a compier setting problem but I do not know what.

Do you have any advice for me?

Thanks!

 

Br,

Carlos
0
Comment
Question by:Carlos1976
  • 3
  • 2
  • 2
7 Comments
 
LVL 32

Expert Comment

by:sarabande
Comment Utility
the dlls were looked for in the folder where the application executable resides, then in windows and system32 folders, then in folders of path environment variable.

though called 'library' the library paths of visual studio are for object libraries only, not for dlls.

Sara
0
 
LVL 44

Expert Comment

by:AndyAinscow
Comment Utility
>>Visual Studio Express

Three points.
1)  As far as I understand it there isn't built in support for MFC, so I don't understand how you are using the options concerning MFC in the build.
2)  Also you might be in breach of your licence agreement with trying to distribute something to other PC's
3)  Just copying dll's (which you  might or might not be allowed to distibute - another potential breach of licence) isn't a good way to distribute your application - some need registering for instance.
0
 
LVL 32

Expert Comment

by:sarabande
Comment Utility
you may download VS2010 runtime at the target computer. it is free. installing it should solve the dll issues.

Sara
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:Carlos1976
Comment Utility
Thanks Sara and Andy,

Well the customers who will use this DLL file will not install the VS2010 runtime, but thanks for this useful information Sara. I will try it on my other PC. :-)

Andy, to create product in VS Express is legal even if the product will be sold or other computer will use. But I got info that Express adds some interesting part to your application (which was created by it) on the way that you can not use on other PC. I do not know and was surprised but maybe.
I use MFC realted part in my main dll code so the MFC is used and I set the MFC static libray so my DLL should include the corresponding MFC part as static.

I do not know the answer yet but thanks for help both of you!
If you have any idea juts share it with me, please!

BR,
Carlos
0
 

Author Comment

by:Carlos1976
Comment Utility
Hi Andy again,

A little bit completion for selling.
I can sell but only if I give the source code too.
It menas that probably I have to see other program than VS Express.
Can you advice me a similar program, please?

Thanks!

Carlos

0
 
LVL 44

Expert Comment

by:AndyAinscow
Comment Utility
VS professional, same environment, you can distribute, MFC should be fully supported.  (Even comes with a licence for a version of Install Shield which you can download - so you get a program you can use to create installations)
0
 
LVL 32

Accepted Solution

by:
sarabande earned 500 total points
Comment Utility
when the customers do not install vs2010 runtime, you could do it with your setup.

i checked my xp system for your dlls and they were missing. seems they were part of ie8 (which i haven't installed). you can freely download them from various sides. check the copyright whether they can distributed.

Sara
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org (http://seleniumhq.org) Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now