From: ebritten@ea.oac.uci.edu (Eric Britten)
Subject: Re: Calling LoadLibrary()
24 Jan 1997 23:34:08 -0800
Approved: cygnus.gnu-win32@cygnus.com
Distribution: cygnus
Message-ID: <Pine.GSO.3.95.970124150832.24936B-100000.cygnus.gnu-win32@rigel.oac.uci.edu>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Original-To: drs <drs@inxpress.net>
Original-cc: gnu-win32@cygnus.com
In-Reply-To: <32E81CA2.5EA8@inxpress.net>
Original-Sender: owner-gnu-win32@cygnus.com



> Has anyone successfuly loaded a dll or driver using LoadLibrary? The
> following seems like it should work; what am I doing wrong?
> 
In Win32 you can't load 16bit dlls with LoadLibrary or LoadLibraryEx.
There is a way to do it though, The Windows 95 Resource Meter applet loads
a 16bit dll to call the free system resources function which does not
exist in Win32.  This is accomplished with Flat Thunks.


Eric Britten.

> /**********************code*************************/
> //dll_load.cpp
> 
> #include <windows.h>
> #include <iostream.h>
> 
> main()
> {
> 	HINSTANCE hLibrary;
> 	hLibrary = LoadLibrary("MMSYSTEM.DLL");
> 	cout << "This is mmsystem's handle: " 
> 	     << hLibrary << endl;
> 
> 	if(hLibrary)
> 	{
> 		FreeLibrary(hLibrary);
> 		return 0;
> 	}
> 	else 
> 	return 0;
> 
> }
> 
> /**************makefile************************/
> 
> #makefile for dll test
> 
> dll_load.exe: dll_load.o
> 	g++ -o dll_load.exe dll_load.o -mwindows
> 
> dll_load.o: dll_load.cpp
> 	g++ -c dll_load.cpp
> -
> For help on using this list, send a message to
> "gnu-win32-request@cygnus.com" with one line of text: "help".
> 

-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
