Check for RTLD flags.
[silc.git] / lib / silcsim / silcsim.h
index 99ba428252c125a249d7940ff782e90dc7cf3341..0d07f3ccf84da40f548ad11c34fe6d5f39c7aef8 100644 (file)
@@ -21,6 +21,8 @@
 #ifndef SILCSIM_H
 #define SILCSIM_H
 
+typedef struct SilcSimStruct *SilcSim;
+
 /* All SIM types. New types maybe freely added. */
 typedef enum {
   SILC_SIM_NONE = 0,
@@ -28,51 +30,25 @@ typedef enum {
   SILC_SIM_HASH,
 } SilcSimType;
 
-/* 
-   SILC Module (SIM) Context.
-
-   This context holds relevant information about the SIM loaded into
-   the system. Following short description of the fields.
-
-   void *handle
-
-       Pointer to the SIM. This is used to get the symbols out of
-       the SIM. This is initalized by system specific routine.
-
-   SilcSimType type
-
-       Type of the SIM.
-
-   char *libname;
-
-       Filename and path to the SIM library file.
-
-   int flags
-
-       Flags used with the SIM. These are system specific flags.
-       See below for more information.
-
-*/
-typedef struct {
-  void *handle;
-  SilcSimType type;
-  char *libname;
-  int flags;
-} SilcSimContext;
-
 /* Flags used to retrieve the symbols from the library file. Default
    is that the symbols are resolved as they are loaded. However, if
    system doesn't support this we have no other choice but to do it lazy
    thus experience some overhead when using the symbol first time. */
+#if defined(RTLD_NOW)
 #define SILC_SIM_FLAGS RTLD_NOW
-/*#define SILC_SIM_FLAGS RTLD_LAZY */
+#elif defined(RTLD_NOW)
+#define SILC_SIM_FLAGS RTLD_LAZY
+#else
+#define SILC_SIM_FLAGS 0
+#endif
 
 /* Prototypes */
-SilcSimContext *silc_sim_alloc();
-void silc_sim_free(SilcSimContext *sim);
-int silc_sim_load(SilcSimContext *sim);
-int silc_sim_close(SilcSimContext *sim);
-char *silc_sim_error();
-void *silc_sim_getsym(SilcSimContext *sim, const char *symbol);
+SilcSim silc_sim_alloc(SilcSimType type, const char *libname, 
+                      SilcUInt32 flags);
+void silc_sim_free(SilcSim sim);
+int silc_sim_load(SilcSim sim);
+int silc_sim_close(SilcSim sim);
+const char *silc_sim_error(SilcSim sim);
+void *silc_sim_getsym(SilcSim sim, const char *symbol);
 
 #endif