Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

LoadLibrary

Posted on 2003-03-10
14
Medium Priority
?
1,352 Views
Last Modified: 2013-11-20
Hi

I have two applications which call the same DLL file using the same code.
The original application works and loads the dll.

The new application I have derived does not.

It seems to fail at the LoadLibrary call. This seems
very strange as I have been through the code of both
apps and they are exactly the same.

Any suggestions
0
Comment
Question by:mjwilliamson
  • 8
  • 3
  • 2
  • +1
14 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 8103991
>>I have been through the code of both apps and they are exactly the same

What does 'GetLastError()' tell us after 'LoadLibrary()' failed?

Are you using hard-coded paths? Is the DLL accessible by the other app?
0
 
LVL 12

Expert Comment

by:williamcampbell
ID: 8104077

  Does the DLL require another DLL. Sometimes a dll will fial to load if it can't find a DLL that it requires.
0
 

Author Comment

by:mjwilliamson
ID: 8104109
to william campbell

Only the shared MFC dlls, apart from that no.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:mjwilliamson
ID: 8104368
OK, I know what the problem is - you wouldn't believe
how long this has taken!!!

i had originally put the dll in app\Debug\PlugIns
and it did not work.

then I put it in app\Debug and it worked fine.

Questions changed.

How do I get my app to pick up DLLs in folders other
than app\Debug

Thanks
Mark
0
 
LVL 86

Expert Comment

by:jkr
ID: 8104421
>>How do I get my app to pick up DLLs in folders other
than app\Debug

Put the directory into your 'PATH' environment. Or (better), create an entry for your app in your registry under "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths" that contains the directory.
0
 
LVL 12

Expert Comment

by:williamcampbell
ID: 8104423

 Which OS?  You need to add to the PATH environment string.
Control Panel / System / Environment.
 
 Or under Project Settings / Debug / Working Directory
0
 

Author Comment

by:mjwilliamson
ID: 8104480
to jkr

How would a set the registry?
0
 

Author Comment

by:mjwilliamson
ID: 8110071
Hmm,don't quite know what happened but I'm back in the
same position.

It was not the call to LoadLibrary but when i try
to call the only exported DLL function.

The last error message is 127

Any suggestions
0
 
LVL 12

Expert Comment

by:williamcampbell
ID: 8112950
//
// MessageId: ERROR_PROC_NOT_FOUND
//
// MessageText:
//
//  The specified procedure could not be found.
//
#define ERROR_PROC_NOT_FOUND             127L

 use the program 'dumpbin.exe' to get the names of the exported functions in your dll and double check the spelling.
0
 

Author Comment

by:mjwilliamson
ID: 8113438
Thanks, I found out myself earlier that you
have to fill in the .def file yourself
for exported functions (or at least thats
what I did)

Everything works fine now - for the minute anyway.

2 day crash course in dlls is not the best approach!

Thanks
Mark
0
 

Author Comment

by:mjwilliamson
ID: 8113488
Thanks, I found out myself earlier that you
have to fill in the .def file yourself
for exported functions (or at least thats
what I did)

Everything works fine now - for the minute anyway.

2 day crash course in dlls is not the best approach!

Thanks
Mark
0
 

Accepted Solution

by:
SpideyMod earned 0 total points
ID: 8527341
PAQ'd and points refunded.

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Integration Management Part 2
Suggested Courses
Course of the Month11 days, 2 hours left to enroll

572 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