[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.c++

DLL Loading Problem

yxyworld

10/22/2008 7:43:00 PM


Hi, everyone. I have a problem with loading a dll in my program using
LoadLibrary( LibaryName ). I'm only having that problem with a
particular dll and never had that problem before. All of my other dlls
are loadable and usable without problems. No significant changes have
been made since the last successful use of the dll in my exe. Here's
the general format of my dll and all my other dlls:

#include <windows.h>
#include <stdio.h>
#include <math.h>
#include <ctime>
#include <cstdlib>

/*
(global constants and some global variables here)
(function and class declarations here)
(global variables here)
*/

#ifdef __cplusplus
extern "C" {
#endif

__declspec(dllexport) void __cdecl SomeFunction1( /* arguments */ )
{
// bla bla bla
}

// the list continues...



BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}

#ifdef __cplusplus
}
#endif

To exclude the possibility that something was wrong in my main program
that caused the error, I've made a simple console program that just
loads the dll using LoadLibrary(), and as expected it returned NULL.
I've tried using GetLastError after the dll failed to load but it just
returned a 0. One of the possible causes that I can think of is my
recent installation of SP3 for WinXP on my PC. Any suggestions and/or
solutions are greatly appreciated.
3 Answers

Ian Collins

10/22/2008 8:18:00 PM

0

yxyworld@gmail.com wrote:
> Hi, everyone. I have a problem with loading a dll in my program using
> LoadLibrary( LibaryName ).

Try a windows group, this is an OS issue rather than a C++ one.
--
Ian Collins

Paavo Helde

10/22/2008 9:00:00 PM

0

yxyworld@gmail.com kirjutas:

>
> Hi, everyone. I have a problem with loading a dll in my program using
> LoadLibrary( LibaryName ). I'm only having that problem with a
> particular dll and never had that problem before. All of my other dlls

So, what problem it was? Probably off-topic here anyway, but as long as you
have not told us, we can never know.

(OT remark: for finding out some loading problems with Windows dll-s you
can use Dependency Walker).

Paavo

Alex

10/23/2008 6:39:00 AM

0

On 10?23?, ??4?59?, Paavo Helde <nob...@ebi.ee> wrote:
> yxywo...@gmail.com kirjutas:
>
>
>
> > Hi, everyone. I have a problem with loading a dll in my program using
> > LoadLibrary( LibaryName ). I'm only having that problem with a
> > particular dll and never had that problem before. All of my other dlls
>
> So, what problem it was? Probably off-topic here anyway, but as long as you
> have not told us, we can never know.
>
> (OT remark: for finding out some loading problems with Windows dll-s you
> can use Dependency Walker).
>
> Paavo

try following command
/////////////////////
dumpbin /exports "your dll name"
/////////////////////
and check the "ordinal" and "name"