| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Semaphores (16 & 32) |
Hello Darin,
On May 28 22:23 96, Darin McBride of 1:342/708 wrote:
DM> DosCreateSem is available in the 16-bit world, but not the 32-bit world.
DM> So I have to link with the 16-bit library to get them. It won't link
DM> with OS2386.LIB.
MS>> 32bit programs. (os2286.lib is for 16bit programs).
DM> Not here - /WATCOM/lib286/os2/os2.lib is for 16-bit
DM> programs. /WATCOM/lib386/os2/os2286.lib is for 32-bit
DM> programs.
DM> Either way - Dos* or Dos16* - the program gives a Sys3175
DM> *before* my code starts.
ok. as i said i don't know how clever watcom is.
a) OS/2 Toolkit ships with 2 DLLs
OS2286.LIB ... for 16bit code
OS2386.LIB ... for 32bit code
b) OS2286.LIB has the DosSem* functions (NOT usable in 32bit code)
c) OS2386.LIB has the Dos16* functions (usable in 32bit code)
(here's from the lib:
00403:DOS16CREATESEM (OFFSET:0x00006bd0, SIZE:0x0000003a):
00404:DOS16OPENSEM (OFFSET:0x00006c10, SIZE:0x00000036):
00400:DOS16SEMSETWAIT (OFFSET:0x00006b10, SIZE:0x0000003c):
00499:DOS16SEMREQUEST (OFFSET:0x000083f0, SIZE:0x0000003c):
00500:DOS16SEMCLEAR (OFFSET:0x00008430, SIZE:0x00000038):
00501:DOS16SEMWAIT (OFFSET:0x00008470, SIZE:0x00000036):
00502:DOS16SEMSET (OFFSET:0x000084b0, SIZE:0x00000034):
00937:DOSPM16SEMCHK (OFFSET:0x0000f9e0, SIZE:0x00000038):
00938:DOS32PM16SEMCHK (OFFSET:0x0000fa20, SIZE:0x0000003c):
00943:DOSPM16SEMRST (OFFSET:0x0000fb90, SIZE:0x00000038):
00944:DOS32PM16SEMRST (OFFSET:0x0000fbd0, SIZE:0x0000003c):
I've now written a small testprogram with VACPP and compiled it and it did
NOT trap. here's the source, the compile option and the disasm. (maybe
WATCOM misses some DosFlat2Sel calls for parameter conversion ???)
#define INCL_DOS
#include
#define CSEM_PRIVATE 0
#define CSEM_PUBLIC 1
#define Dos16CreateSem DOS16CREATESEM
#define DosCreateSem DOS16CREATESEM
typedef LHANDLE HSYSSEM; /* hssm */
typedef HSYSSEM FAR *PHSYSSEM;
APIRET16 APIENTRY16 DosCreateSem(USHORT fExclusive
,PHSYSSEM phsem
,PSZ pszSemName);
main(int argc, char *argv[], char *envp[])
{
HSYSSEM hssm;
APIRET16 rc=DosCreateSem(CSEM_PRIVATE,
&hssm,
"\\sem\\abc.sem");
}
/**************
main proc
push 010h
push 0106eh
call __EDCThunkProlog
push ebp
mov ebp,esp
sub esp,08h
mov [ebp+0ch],eax; argc
mov [ebp+010h],edx; argv
mov [ebp+014h],ecx; envp
sub esp,03ah
push word ptr 0h
lea eax,[ebp-08h]; hssm
call _DosFlatToSel
push eax
mov eax,offset FLAT:{at}CBE1
call _DosFlatToSel
push eax
push 0ah
push eax
mov eax,offset FLAT: DOS16CREATESEM
call _DosFlatToSel
xchg eax, dword ptr[esp]
push 0h
call __EDC3216
add esp,050h
mov [ebp-02h],ax; rc
xor eax,eax
leave
pop esp
ret
*******************/
> 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...?
yes. (and DosSemRequest is in DosCall1.Dll). i'm not sure what is called,
but in the debugger i can see that there is some code called.
(maybe the function is exported only be ordinal and not by name?)
(the ordinal values can be found in bseord.h:
#define ORD_DOSCLOSESEM 23
#define ORD_DOSCREATESEM 24
#define ORD_DOSOPENSEM 25
...
)
WARPED!, Mario
--- Msgedsq/2 2.2e
* Origin: LC/32 Development Team-Vienna-Austria (2:310/14.11)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: 310/14 1 24/999 888 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™.