comparison os2/dw.c @ 157:a07dd2e819f3

Added module support.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 12 Nov 2002 08:52:22 +0000
parents 63258b34e70d
children 9c0f1f04f4c7
comparison
equal deleted inserted replaced
156:63258b34e70d 157:a07dd2e819f3
6458 void dw_beep(int freq, int dur) 6458 void dw_beep(int freq, int dur)
6459 { 6459 {
6460 DosBeep(freq, dur); 6460 DosBeep(freq, dur);
6461 } 6461 }
6462 6462
6463 /* Open a shared library and return a handle.
6464 * Parameters:
6465 * name: Base name of the shared library.
6466 * handle: Pointer to a module handle,
6467 * will be filled in with the handle.
6468 */
6469 int dw_module_load(char *name, HMOD *handle)
6470 {
6471 char objnamebuf[300] = "";
6472
6473 return DosLoadModule(objnamebuf, sizeof(objnamebuf), name, handle);
6474 }
6475
6476 /* Queries the address of a symbol within open handle.
6477 * Parameters:
6478 * handle: Module handle returned by dw_module_load()
6479 * name: Name of the symbol you want the address of.
6480 * func: A pointer to a function pointer, to obtain
6481 * the address.
6482 */
6483 int dw_module_symbol(HMOD handle, char *name, void**func)
6484 {
6485 return DosQueryProcAddr(handle, 0, name, (PFN*)func);
6486 }
6487
6488 /* Frees the shared library previously opened.
6489 * Parameters:
6490 * handle: Module handle returned by dw_module_load()
6491 */
6492 int dw_module_close(HMOD handle)
6493 {
6494 DosFreeModule(handle);
6495 }
6496
6463 /* 6497 /*
6464 * Returns the handle to an unnamed mutex semaphore. 6498 * Returns the handle to an unnamed mutex semaphore.
6465 */ 6499 */
6466 HMTX dw_mutex_new(void) 6500 HMTX dw_mutex_new(void)
6467 { 6501 {