TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: All
from: Billy O`connor
date: 1994-09-21 17:30:00
subject: Dosqueryprocaddr

Hello, all.

I am trying to use the IBM Cset library function, _loadmod, and am having 
some difficulty.  The code below is the smallest reproduction of the problem
that I could create.  The problem I'm  having is that I cannot use
DosQueryProcAddr with the function name.  I can only load the function with
the ordinal number.  Cset documentation seems to read that the code below 
will work.  DosQueryProcAddr works fine with the ordinal number of the 
function, but when called with the function name it returns 127, which is 
not even in the list of possible return codes for DosQueryProcAddr!?


/********************   runme.c(main program)   *****************************/
#define	INCL_DOSMODULEMGR
#define	INCL_DOSMISC
#include 

int	main(void) {
	UCHAR		dllPath[256],dllName[] = "PRINTME.DLL";
	HMODULE		dllHandle;
	PFN			faddr;
	APIRET		rc;

	DosSearchPath(SEARCH_CUR_DIRECTORY,"PATH",dllName,dllPath,sizeof(dllPath));
	_loadmod(dllPath,&dllHandle);
	rc=DosQueryProcAddr(dllHandle,0,"printme",&faddr);
	if(rc!=0) {
		printf("DosQueryProcAddr failed with rc=%ld.\n",rc);
		_freemod(dllHandle);
		return;
	}
	faddr();
	printf("Back in main program\n");
	return;
}
/******************   end of runme.c   *******************************/
/*********************   printme.c(the DLL) **************************/
void	printme(void) {
	printf("inside dll\n");
}
/*********************  end of printme.c  ****************************/
/********************   printme.def   ********************************/
library	printme	
data	multiple	nonshared
protmode
exports
	printme	{at}1
/*******************   end of printme.def   **************************/
/*******************   makefile   ************************************/
all:	printme.dll printme.lib runme.exe
clean:	
	del *.exe *.obj *.map *.lib *.dll
printme.dll:	printme.obj printme.def
	link386.exe /de /align:4 \
		printme.obj,printme.dll,,,printme.def
printme.lib:	printme.def printme.dll
	implib printme.lib printme.def
printme.obj:	printme.c
	icc.exe /Sm /Ss /Q /Ti /C /Ge- printme.c
runme.exe:	runme.obj
	link386.exe /de /align:4 \
		runme.obj;
runme.obj:	runme.c printme.dll
	icc.exe /Sm /Ss /Q /Ti /C runme.c
/******************   end of makefile   *******************************/

Scratching my head,

___
 * MR/2 2.05 NR * billyoc{at}netcom.com

--- QScan v1.12b / 01-0042

* Origin: (1:101/330)
SEEN-BY: 12/2442 54/54 620/243 624/50 632/348 640/820 690/660 711/409 410 413
SEEN-BY: 711/430 807 808 809 934 942 712/353 623 713/888 800/1
@PATH: 101/330 180 324/288 3615/50 229/2 12/2442 711/409 54/54 711/808 809
@PATH: 711/934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.