TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Mario Semo
from: Darin McBride
date: 1996-05-28 22:23:16
subject: Semaphores (16 & 32)

DM> Since I'm using Watcom (10.6), I have the PRCP.INF 

 MS> i don't have WatCom and i don't know how clever the compiler is.

I was just noting that I got PRCP.INF with Watcom.

 DM> file which, handily, has DosCreateSem which wants 
 DM> to use \SEM\ instead.  

 DM> seems.  I created the function prototypes, having noticed 

 MS> how?

typedef void _far16 * HSEM16;
typedef HSEM16 _far16 * PHSEM16;
typedef const char _far16 * PCSZ16;

APIRET16 APIENTRY16 DosCreateSem(USHORT  usNoExclusive,
                                 PHSEM16 phsemSemHandle,
                                 PCSZ16  pszSemName);
APIRET16 APIENTRY16 DosOpenSem(PHSEM16 SemHandle,
                               PCSZ16 SemName);
APIRET16 APIENTRY16 DosSemRequest(HSEM16  hsemSemHandle,
                                  LONG  lTimeout);
APIRET16 APIENTRY16 DosSemClear(HSEM16 hsemSemHandle);
APIRET16 APIENTRY16 DosCloseSem(HSEM16 hsemSemHandle);


 MS> I would assume the following is correct (for VACPP). 
 MS> for WAtcom i can't say. maybe you have to define the 
 MS> parameters as 16bit pointers too.


 MS>  #define Dos16CreateSem     DOS16CREATESEM
 MS>  #define DosCreateSem       DOS16CREATESEM

I cannot find either DOSCREATESEM or DOS16CREATESEM in *any* DLL in the
/os2/dll directory.  And yet, both are available in the OS2286.LIB file...?

 MS>  typedef LHANDLE HSYSSEM;        /* hssm */

(LHANDLE is a void*)

 MS>  typedef HSYSSEM FAR *PHSYSSEM;

 MS>  APIRET16 APIENTRY16 DosCreateSem(USHORT fExclusive
 MS>                                  ,PHSYSSEM phsem
 MS>                                  ,PSZ pszSemName);

 DM> that these functions were in OS2286.LIB, and linked with 

 MS> who links os2286.lib? is assume os2386.lib is used for 

DosCreateSem is available in the 16-bit world, but not the 32-bit world. 
So I have to link with the 16-bit library to get them.  It won't link with
OS2386.LIB.

 MS> 32bit programs. (os2286.lib is for 16bit programs).

Not here - /WATCOM/lib286/os2/os2.lib is for 16-bit programs. 
/WATCOM/lib386/os2/os2286.lib is for 32-bit programs.

Either way - Dos* or Dos16* - the program gives a Sys3175 *before* my code starts.


--- Maximus/2 3.01
* Origin: Tanktalus' Tower BBS (PVT) (1:342/708)
SEEN-BY: 50/99 270/101 620/243 711/401 409 410 413 430 808 809 934 955
SEEN-BY: 712/407 515 517 628 713/888 800/1
@PATH: 342/5015 61 3615/50 396/1 270/101 712/515 711/808 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™.