diff 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
line wrap: on
line diff
--- a/os2/dw.c	Fri Nov 08 17:38:59 2002 +0000
+++ b/os2/dw.c	Tue Nov 12 08:52:22 2002 +0000
@@ -6460,6 +6460,40 @@
 	DosBeep(freq, dur);
 }
 
+/* Open a shared library and return a handle.
+ * Parameters:
+ *         name: Base name of the shared library.
+ *         handle: Pointer to a module handle,
+ *                 will be filled in with the handle.
+ */
+int dw_module_load(char *name, HMOD *handle)
+{
+	char objnamebuf[300] = "";
+
+	return DosLoadModule(objnamebuf, sizeof(objnamebuf), name, handle);
+}
+
+/* Queries the address of a symbol within open handle.
+ * Parameters:
+ *         handle: Module handle returned by dw_module_load()
+ *         name: Name of the symbol you want the address of.
+ *         func: A pointer to a function pointer, to obtain
+ *               the address.
+ */
+int dw_module_symbol(HMOD handle, char *name, void**func)
+{
+	return DosQueryProcAddr(handle, 0, name, (PFN*)func);
+}
+
+/* Frees the shared library previously opened.
+ * Parameters:
+ *         handle: Module handle returned by dw_module_load()
+ */
+int dw_module_close(HMOD handle)
+{
+	DosFreeModule(handle);
+}
+
 /*
  * Returns the handle to an unnamed mutex semaphore.
  */