?
Solved

LoadLibrary

Posted on 2003-03-10
14
Medium Priority
?
1,343 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

 

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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses
Course of the Month13 days, 10 hours left to enroll

801 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