Link to home
Start Free TrialLog in
Avatar of Carlos1976
Carlos1976

asked on

Cannot load library error 126

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
Avatar of sarabande
sarabande
Flag of Luxembourg image

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
>>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.
you may download VS2010 runtime at the target computer. it is free. installing it should solve the dll issues.

Sara
Avatar of Carlos1976
Carlos1976

ASKER

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
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

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)
ASKER CERTIFIED SOLUTION
Avatar of sarabande
sarabande
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial