Index: trunk/include/regfi.h
===================================================================
--- trunk/include/regfi.h	(revision 200)
+++ trunk/include/regfi.h	(revision 201)
@@ -71,8 +71,8 @@
 #include <iconv.h>
 #include <pthread.h>
+#include <talloc.h>
 
 /* regfi headers */
 #include <byteorder.h>
-#include <talloc.h>
 #include <winsec.h>
 #include <void_stack.h>
@@ -80,4 +80,9 @@
 #include <lru_cache.h>
 
+/* GCC-specific macro for library exports */
+#ifdef _EXPORT
+#undef _EXPORT
+#endif
+#define _EXPORT __attribute__((visibility("default")))
 
 
@@ -859,5 +864,6 @@
  * @ingroup regfiBase
  */
-REGFI_FILE*           regfi_alloc(int fd);
+_EXPORT
+REGFI_FILE* regfi_alloc(int fd);
 
 
@@ -874,5 +880,6 @@
  * @ingroup regfiBase
  */
-REGFI_FILE*           regfi_alloc_cb(REGFI_RAW_FILE* file_cb);
+_EXPORT
+REGFI_FILE* regfi_alloc_cb(REGFI_RAW_FILE* file_cb);
 
 
@@ -883,5 +890,6 @@
  * @ingroup regfiBase
  */
-void                  regfi_free(REGFI_FILE* file);
+_EXPORT
+void regfi_free(REGFI_FILE* file);
 
 
@@ -893,4 +901,5 @@
  * @ingroup regfiBase
  */
+_EXPORT
 char* regfi_log_get_str();
 
@@ -922,4 +931,5 @@
  * @ingroup regfiBase
  */
+_EXPORT
 bool regfi_log_set_mask(uint16_t mask);
 
@@ -939,4 +949,5 @@
  * @ingroup regfiBase
  */
+_EXPORT
 void regfi_free_record(const void* record);
 
@@ -969,5 +980,6 @@
  * @ingroup regfiIteratorLayer
  */
-REGFI_ITERATOR*       regfi_iterator_new(REGFI_FILE* file,
+_EXPORT
+REGFI_ITERATOR* regfi_iterator_new(REGFI_FILE* file,
 					 REGFI_ENCODING output_encoding);
 
@@ -981,5 +993,6 @@
  * @ingroup regfiIteratorLayer
  */
-void                  regfi_iterator_free(REGFI_ITERATOR* i);
+_EXPORT
+void regfi_iterator_free(REGFI_ITERATOR* i);
 
 
@@ -997,5 +1010,6 @@
  * @ingroup regfiIteratorLayer
  */
-bool                  regfi_iterator_down(REGFI_ITERATOR* i);
+_EXPORT
+bool regfi_iterator_down(REGFI_ITERATOR* i);
 
 
@@ -1009,5 +1023,6 @@
  * @ingroup regfiIteratorLayer
  */
-bool                  regfi_iterator_up(REGFI_ITERATOR* i);
+_EXPORT
+bool regfi_iterator_up(REGFI_ITERATOR* i);
 
 
@@ -1020,5 +1035,6 @@
  * @ingroup regfiIteratorLayer
  */
-bool                  regfi_iterator_to_root(REGFI_ITERATOR* i);
+_EXPORT
+bool regfi_iterator_to_root(REGFI_ITERATOR* i);
 
 
@@ -1041,4 +1057,5 @@
  * @ingroup regfiIteratorLayer
  */
+_EXPORT
 bool regfi_iterator_walk_path(REGFI_ITERATOR* i, const char** path);
 
@@ -1052,4 +1069,5 @@
  * @ingroup regfiIteratorLayer
  */
+_EXPORT
 const REGFI_NK_REC* regfi_iterator_cur_key(REGFI_ITERATOR* i);
 
@@ -1063,4 +1081,5 @@
  * @ingroup regfiIteratorLayer
  */
+_EXPORT
 const REGFI_SK_REC* regfi_iterator_cur_sk(REGFI_ITERATOR* i);
 
@@ -1075,4 +1094,5 @@
  * @ingroup regfiIteratorLayer
  */
+_EXPORT
 bool regfi_iterator_first_subkey(REGFI_ITERATOR* i);
 
@@ -1088,4 +1108,5 @@
  * @ingroup regfiIteratorLayer
  */
+_EXPORT
 const REGFI_NK_REC* regfi_iterator_cur_subkey(REGFI_ITERATOR* i);
 
@@ -1099,4 +1120,5 @@
  * @ingroup regfiIteratorLayer
  */
+_EXPORT
 bool regfi_iterator_next_subkey(REGFI_ITERATOR* i);
 
@@ -1113,4 +1135,5 @@
  * @ingroup regfiIteratorLayer
  */
+_EXPORT
 bool regfi_iterator_find_subkey(REGFI_ITERATOR* i, const char* subkey_name);
 
@@ -1125,4 +1148,5 @@
  * @ingroup regfiIteratorLayer
  */
+_EXPORT
 bool regfi_iterator_first_value(REGFI_ITERATOR* i);
 
@@ -1138,4 +1162,5 @@
  * @ingroup regfiIteratorLayer
  */
+_EXPORT
 const REGFI_VK_REC* regfi_iterator_cur_value(REGFI_ITERATOR* i);
 
@@ -1149,4 +1174,5 @@
  * @ingroup regfiIteratorLayer
  */
+_EXPORT
 bool regfi_iterator_next_value(REGFI_ITERATOR* i);
 
@@ -1163,6 +1189,7 @@
  * @ingroup regfiIteratorLayer
  */
-bool                  regfi_iterator_find_value(REGFI_ITERATOR* i, 
-						const char* value_name);
+_EXPORT
+bool regfi_iterator_find_value(REGFI_ITERATOR* i, 
+			       const char* value_name);
 
 /** Retrieves classname for a given key.
@@ -1176,4 +1203,5 @@
  * @ingroup regfiIteratorLayer
  */
+_EXPORT
 const REGFI_CLASSNAME* regfi_iterator_fetch_classname(REGFI_ITERATOR* i, 
 						      const REGFI_NK_REC* key);
@@ -1190,4 +1218,5 @@
  * @ingroup regfiIteratorLayer
  */
+_EXPORT
 const REGFI_DATA* regfi_iterator_fetch_data(REGFI_ITERATOR* i,
 					    const REGFI_VK_REC* value);
@@ -1207,7 +1236,8 @@
  * @ingroup regfiGlueLayer
  */
-REGFI_NK_REC*         regfi_load_key(REGFI_FILE* file, uint32_t offset, 
-				     REGFI_ENCODING output_encoding, 
-				     bool strict);
+_EXPORT
+REGFI_NK_REC* regfi_load_key(REGFI_FILE* file, uint32_t offset, 
+			     REGFI_ENCODING output_encoding, 
+			     bool strict);
 
 
@@ -1218,29 +1248,32 @@
  * @ingroup regfiGlueLayer
  */
-REGFI_VK_REC*         regfi_load_value(REGFI_FILE* file, uint32_t offset, 
-				       REGFI_ENCODING output_encoding, 
+_EXPORT
+REGFI_VK_REC* regfi_load_value(REGFI_FILE* file, uint32_t offset, 
+			       REGFI_ENCODING output_encoding, 
+			       bool strict);
+
+
+/** Loads a logical subkey list in its entirety which may span multiple records.
+ *
+ * XXX: finish documenting
+ *
+ * @ingroup regfiGlueLayer
+ */
+_EXPORT
+REGFI_SUBKEY_LIST* regfi_load_subkeylist(REGFI_FILE* file, uint32_t offset,
+					 uint32_t num_keys, uint32_t max_size,
+					 bool strict);
+
+
+/** Loads a valuelist.
+ *
+ * XXX: finish documenting
+ *
+ * @ingroup regfiGlueLayer
+ */
+_EXPORT
+REGFI_VALUE_LIST* regfi_load_valuelist(REGFI_FILE* file, uint32_t offset, 
+				       uint32_t num_values, uint32_t max_size,
 				       bool strict);
-
-
-/** Loads a logical subkey list in its entirety which may span multiple records.
- *
- * XXX: finish documenting
- *
- * @ingroup regfiGlueLayer
- */
-REGFI_SUBKEY_LIST*    regfi_load_subkeylist(REGFI_FILE* file, uint32_t offset,
-					    uint32_t num_keys, uint32_t max_size,
-					    bool strict);
-
-
-/** Loads a valuelist.
- *
- * XXX: finish documenting
- *
- * @ingroup regfiGlueLayer
- */
-REGFI_VALUE_LIST*     regfi_load_valuelist(REGFI_FILE* file, uint32_t offset, 
-					   uint32_t num_values, uint32_t max_size,
-					   bool strict);
 
 
@@ -1252,7 +1285,8 @@
  * @ingroup regfiGlueLayer
  */
-REGFI_BUFFER          regfi_load_data(REGFI_FILE* file, uint32_t voffset,
-				      uint32_t length, bool data_in_offset,
-				      bool strict);
+_EXPORT
+REGFI_BUFFER regfi_load_data(REGFI_FILE* file, uint32_t voffset,
+			     uint32_t length, bool data_in_offset,
+			     bool strict);
 
 
@@ -1263,8 +1297,9 @@
  * @ingroup regfiGlueLayer
  */
-REGFI_BUFFER          regfi_load_big_data(REGFI_FILE* file, uint32_t offset, 
-					  uint32_t data_length,uint32_t cell_length,
-					  range_list* used_ranges,
-					  bool strict);
+_EXPORT
+REGFI_BUFFER regfi_load_big_data(REGFI_FILE* file, uint32_t offset, 
+				 uint32_t data_length,uint32_t cell_length,
+				 range_list* used_ranges,
+				 bool strict);
 
 
@@ -1276,7 +1311,8 @@
  * @ingroup regfiGlueLayer
  */
-bool                  regfi_interpret_data(REGFI_FILE* file, 
-					   REGFI_ENCODING string_encoding,
-					   uint32_t type, REGFI_DATA* data);
+_EXPORT
+bool regfi_interpret_data(REGFI_FILE* file, 
+			  REGFI_ENCODING string_encoding,
+			  uint32_t type, REGFI_DATA* data);
 
 
@@ -1290,6 +1326,7 @@
  * @ingroup regfiGlueLayer
  */
-const REGFI_SK_REC*   regfi_load_sk(REGFI_FILE* file, uint32_t offset,
-				    bool strict);
+_EXPORT
+const REGFI_SK_REC* regfi_load_sk(REGFI_FILE* file, uint32_t offset,
+				  bool strict);
 
 
@@ -1300,5 +1337,6 @@
  * @ingroup regfiGlueLayer
  */
-const REGFI_HBIN*     regfi_lookup_hbin(REGFI_FILE* file, uint32_t offset);
+_EXPORT
+const REGFI_HBIN* regfi_lookup_hbin(REGFI_FILE* file, uint32_t offset);
 
 
@@ -1310,7 +1348,10 @@
 /******************************************************************************/
 
-REGFI_FILE*           regfi_parse_regf(REGFI_RAW_FILE* file_cb, bool strict);
-REGFI_HBIN*           regfi_parse_hbin(REGFI_FILE* file, uint32_t offset, 
-				       bool strict);
+_EXPORT
+REGFI_FILE* regfi_parse_regf(REGFI_RAW_FILE* file_cb, bool strict);
+
+_EXPORT
+REGFI_HBIN* regfi_parse_hbin(REGFI_FILE* file, uint32_t offset, 
+			     bool strict);
 
 
@@ -1327,6 +1368,7 @@
  * @ingroup regfiParseLayer
  */
-REGFI_NK_REC*         regfi_parse_nk(REGFI_FILE* file, uint32_t offset,
-				     uint32_t max_size, bool strict);
+_EXPORT
+REGFI_NK_REC* regfi_parse_nk(REGFI_FILE* file, uint32_t offset,
+			     uint32_t max_size, bool strict);
 
 
@@ -1337,6 +1379,7 @@
  * @ingroup regfiParseLayer
  */
-REGFI_SUBKEY_LIST*    regfi_parse_subkeylist(REGFI_FILE* file, uint32_t offset,
-					     uint32_t max_size, bool strict);
+_EXPORT
+REGFI_SUBKEY_LIST* regfi_parse_subkeylist(REGFI_FILE* file, uint32_t offset,
+					  uint32_t max_size, bool strict);
 
 
@@ -1347,6 +1390,7 @@
  * @ingroup regfiParseLayer
  */
-REGFI_VK_REC*         regfi_parse_vk(REGFI_FILE* file, uint32_t offset, 
-				     uint32_t max_size, bool strict);
+_EXPORT
+REGFI_VK_REC* regfi_parse_vk(REGFI_FILE* file, uint32_t offset, 
+			     uint32_t max_size, bool strict);
 
 
@@ -1357,6 +1401,7 @@
  * @ingroup regfiParseLayer
  */
-REGFI_SK_REC*         regfi_parse_sk(REGFI_FILE* file, uint32_t offset, 
-				     uint32_t max_size, bool strict);
+_EXPORT
+REGFI_SK_REC* regfi_parse_sk(REGFI_FILE* file, uint32_t offset, 
+			     uint32_t max_size, bool strict);
 
 
@@ -1370,5 +1415,6 @@
  * @ingroup regfiParseLayer
  */
-range_list*           regfi_parse_unalloc_cells(REGFI_FILE* file);
+_EXPORT
+range_list* regfi_parse_unalloc_cells(REGFI_FILE* file);
 
 
@@ -1379,7 +1425,8 @@
  * @ingroup regfiParseLayer
  */
-bool                  regfi_parse_cell(REGFI_RAW_FILE* file_cb, uint32_t offset,
-				       uint8_t* hdr, uint32_t hdr_len,
-				       uint32_t* cell_length, bool* unalloc);
+_EXPORT
+bool regfi_parse_cell(REGFI_RAW_FILE* file_cb, uint32_t offset,
+		      uint8_t* hdr, uint32_t hdr_len,
+		      uint32_t* cell_length, bool* unalloc);
 
 
@@ -1390,7 +1437,8 @@
  * @ingroup regfiParseLayer
  */
-uint8_t*                regfi_parse_classname(REGFI_FILE* file, uint32_t offset,
-					    uint16_t* name_length, 
-					    uint32_t max_size, bool strict);
+_EXPORT
+uint8_t* regfi_parse_classname(REGFI_FILE* file, uint32_t offset,
+			       uint16_t* name_length, 
+			       uint32_t max_size, bool strict);
 
 
@@ -1401,6 +1449,7 @@
  * @ingroup regfiParseLayer
  */
-REGFI_BUFFER          regfi_parse_data(REGFI_FILE* file, uint32_t offset,
-				       uint32_t length, bool strict);
+_EXPORT
+REGFI_BUFFER regfi_parse_data(REGFI_FILE* file, uint32_t offset,
+			      uint32_t length, bool strict);
 
 
@@ -1412,6 +1461,7 @@
  * @ingroup regfiParseLayer
  */
-REGFI_BUFFER          regfi_parse_little_data(REGFI_FILE* file, uint32_t voffset, 
-					      uint32_t length, bool strict);
+_EXPORT
+REGFI_BUFFER regfi_parse_little_data(REGFI_FILE* file, uint32_t voffset, 
+				     uint32_t length, bool strict);
 
 
@@ -1426,15 +1476,23 @@
 ssize_t               regfi_raw_read(REGFI_RAW_FILE* self, 
 				     void* buf, size_t count);
+_EXPORT
 off_t                 regfi_seek(REGFI_RAW_FILE* file_cb, 
 				 off_t offset, int whence);
+_EXPORT
 uint32_t              regfi_read(REGFI_RAW_FILE* file_cb, 
 				 uint8_t* buf, uint32_t* length);
 
+_EXPORT
 const char*           regfi_type_val2str(unsigned int val);
+_EXPORT
 int                   regfi_type_str2val(const char* str);
 
+_EXPORT
 char*                 regfi_get_sacl(WINSEC_DESC* sec_desc);
+_EXPORT
 char*                 regfi_get_dacl(WINSEC_DESC* sec_desc);
+_EXPORT
 char*                 regfi_get_owner(WINSEC_DESC* sec_desc);
+_EXPORT
 char*                 regfi_get_group(WINSEC_DESC* sec_desc);
 
@@ -1449,4 +1507,5 @@
 REGFI_NK_REC*         regfi_copy_nk(const REGFI_NK_REC* nk);
 REGFI_VK_REC*         regfi_copy_vk(const REGFI_VK_REC* vk);
+_EXPORT
 int32_t               regfi_calc_maxsize(REGFI_FILE* file, uint32_t offset);
 int32_t               regfi_conv_charset(const char* input_charset, 
@@ -1454,13 +1513,18 @@
 					 uint8_t* input, char* output, 
 					 uint32_t input_len, uint32_t output_max);
+_EXPORT
 REGFI_DATA*           regfi_buffer_to_data(REGFI_BUFFER raw_data);
 
 /* XXX: move to base API and document */
+_EXPORT
 void                  regfi_unix2nt_time(REGFI_NTTIME* nt, time_t t);
+_EXPORT
 time_t                regfi_nt2unix_time(const REGFI_NTTIME* nt);
 
 
+_EXPORT
 void regfi_interpret_keyname(REGFI_FILE* file, REGFI_NK_REC* nk, 
 			     REGFI_ENCODING output_encoding, bool strict);
+_EXPORT
 void regfi_interpret_valuename(REGFI_FILE* file, REGFI_VK_REC* vk, 
 			       REGFI_ENCODING output_encoding, bool strict);
