15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Cannot load extension dll's.

Kanir Pandya -- kpandya@harbinger.net
Thursday, April 04, 1996

I have Created a MFC extension dll using AppWizard of VC++ 4.0, on 
windows 95. In my application class I am using following code to load 
the dll.
CMyApp::InitInstance()
{
    m_hResDLLInst = LoadLibrary("mydll.dll");
    if (m_hResDLLInst == NULL) {
	CString str;
	DWORD err;
	err = GetLastError();
	str.Format ("Could not load inpres.dll. with error %ld",err);
		AfxMessageBox (str);
    }
}

It works fine, if the PC hasVisual C++ 4.0  on it. If  PC does not 
haveVisual C++ 4.0 it does not load the dll. The GetLastError() 
returns error code 1157, which stands for dll not found.  I am 
distributing mfc40.dll and msvcrt40.dll. I am missing any dll. 

Thanks for your help.


Kanir Pandya
Sr. Software Enggineer
Harbinger Net services
1055, Lenox Park Blvd.
Atlanta, GA-30319
Phone : (404) 841-4324 x3152



David W. Gillett -- DGILLETT@expertedge.com
Friday, April 05, 1996

>     m_hResDLLInst = LoadLibrary("mydll.dll");
>     if (m_hResDLLInst == NULL) {
> 
> It works fine, if the PC hasVisual C++ 4.0  on it. If  PC does not 
> haveVisual C++ 4.0 it does not load the dll. The GetLastError() 
> returns error code 1157, which stands for dll not found.  I am 
> distributing mfc40.dll and msvcrt40.dll. I am missing any dll. 

  LoadLibrary looks in a documented series of places for the DLL.  
Does your setup routine install MYDLL.DLL to one of those places?

Dave

 



VARughese GEOrge -- vargeo@msn.com
Saturday, April 06, 1996

[Mini-digest: 4 responses]

Hi Kanir,

It looks like that your extension DLL  is trying to statically load another 
DLL.
Except for your own DLLs, on the MFC front your distribution is dependent on
what features of MFC you  are using in your extension DLL.. like 3D controld 
[CTL3D32.DLL], MFC ODBC classes [ODBC distribution DLLs] etc. Since you are on 
Windows95 u don't have to worry about Unicode [MFC40U.DLL]... 

Incase if you are experienceing  this LoadLibrary problem with the debug build 
of your extension DLL then remember that the debug  version of MFC is spilt 
into 4 DLLs [MFC40D.DLL, MFCD40D.DLL, MFCN40D.DLL and MFCO40D.DLL]

If you are using OLE controls then please read how to distribute MFCx40.DLL 
and OLEPRO32.DLL and the registering business.. I remember reading it in 
VisualC++ books on-line..


just a thought...
your LoadLibrary validation may be better of like this...

	HINSTANCE hResDLLInst = LoadLibrary("mydll.dll");
	if (hResDLLInst < (HINSTANCE) HINSTANCE_ERROR)
	{
		//Load failed.. error handling..
	}

anyway hope this helps..

now i am  awake.. until i sleep again...
vargeo



-----From: Dan Kirby 

Hi,
All of the files that are needed are listed in the 
\MSDEV\REDIST\redistrb.wri.  It looks like you are only missing a couple 
files - CTL3d32.dll and olepro32.dll.
Also, as a side note, use AfxLoadLibrary to load the extension DLL.

--dan

-----From: djw@arbortext.com (David J. Wilson)

If the application loads with 4.0 installed, but not when it isn't installed,
it sounds like there's another dll you need to be distributing.  If the issue
was where you've placed mydll.dll, I would expect the problem to be independent
of whether 4.0 is installed on the machine.

Since you can run with 4.0 installed, I would suggest launching the application
from within the Developer Studio, in debug mode.  If your output window is
activated (View/Output, or Alt+2) you will see a line of output as each dll is
loaded.  E.g. "Loading symbols for 'C:\WINNT\system32\comdlg32.dll'".  Armed
with that list of dll's, you should be able to determine which ones are missing
on the system where the application won't run, and you'll know what you need
to add to your distribution.

Dave Wilson  djw@arbortext.com
ArborText Inc.  Ann Arbor Michigan

-----From: "Mike Blaszczak" 

> I have Created a MFC extension dll using AppWizard of VC++ 4.0, on 
> windows 95.

Thanks.

> m_hResDLLInst = LoadLibrary("mydll.dll");

Since you're dynamically loading an MFC extension library, you should use 
AfxLoadLibrary().  This is discussed in Tech Note #33.

> It works fine, if the PC hasVisual C++ 4.0  on it. If  PC does not 
> haveVisual C++ 4.0 it does not load the dll. The GetLastError() 
> returns error code 1157, which stands for dll not found.  I am 
> distributing mfc40.dll and msvcrt40.dll. I am missing any dll. 

It depends on what features you've added to your application and to that DLL.  
You should read the FAQ: there, it is explained that you should read the 
REDISTRB.WRI file which is in the REDISTRB directory on your CD.  That file 
explains what DLLs you need to redistribute in all sorts of different 
situations.

.B ekiM
TCHAR sz[] = _T("");



William Cook -- wcook@msn.com
Monday, April 08, 1996

>I am distributing mfc40.dll and msvcrt40.dll. I am missing any dll. 

What you're missing depends on your build. If you're running the release build 
and you use OLE, check and make sure that all of the OLE DLLs are installed, 
making sure you have a current version of OLEPRO32.DLL (This in addition to 
MFC40.DLL and MSVCRT40.DLL). If you're running the _DEBUG version, you'll need 
MFC40D.DLL & MSVCR40D.DLL. If you're using OLE, MFCO40D.DLL and OLEPRO32.DLL. 
If you're using the database stuff, MFCD40D.DLL. If you're using the network 
stuff, MFCN40D.DLL.

Bill Cook _/)_



Mike Blaszczak -- mikeblas@msn.com
Wednesday, April 10, 1996

----------
From: 	owner-mfc-l@netcom.com on behalf of William Cook
Sent: 	Monday, April 08, 1996 8:13 AM

>>I am distributing mfc40.dll and msvcrt40.dll. I am missing any dll. 

> MFC40.DLL and MSVCRT40.DLL). If you're running the _DEBUG version, you'll 
need  
> MFC40D.DLL & MSVCR40D.DLL. If you're using OLE, MFCO40D.DLL and 
OLEPRO32.DLL. 
> If you're using the database stuff, MFCD40D.DLL. If you're using the network 

> stuff, MFCN40D.DLL.

Please remember that debug builds of the MFC shared library are not 
redistributable.

.B ekiM
TCHAR szAdvice[] = _T("Check twice, save a life: motorcycles are everywhere!");




| Вернуться в корень Архива |