Solved

Cannot load library error 126

Posted on 2011-03-21
7
2,789 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 33

Expert Comment

by:sarabande
ID: 35181348
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
ID: 35181399
>>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 33

Expert Comment

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

Sara
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

Author Comment

by:Carlos1976
ID: 35181744
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
ID: 35181876
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
ID: 35181930
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 33

Accepted Solution

by:
sarabande earned 500 total points
ID: 35182082
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
What are the big features of MVC5? 4 93
What is MicroStrategy.NET? 2 73
How can i compile this github project?? 2 91
Finding Divisors 5 21
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilationā€¦
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called eeā€¦
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

808 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