diff --git a/rply.h b/rply.h index 9fa6da9..2e2a0c5 100644 --- a/rply.h +++ b/rply.h @@ -1,5 +1,5 @@ -#ifndef RPLY_H -#define RPLY_H +#pragma once + /* ---------------------------------------------------------------------- * RPly library, read/write PLY files * Diego Nehab, IMPA @@ -9,6 +9,19 @@ * at the end of this file. * ---------------------------------------------------------------------- */ +#ifdef RPLY_SHARED_LIB + +#ifdef RPLY_BUILD_LIB +#define RPLY_DLL_DEF __declspec(dllexport) +#else +#define RPLY_DLL_DEF __declspec(dllimport) +#endif // RPLY_BUILD_LIB + +#else +#define RPLY_DLL_DEF +#endif // RPLY_SHARED_LIB + + #ifdef __cplusplus extern "C" { #endif @@ -57,6 +70,8 @@ typedef void (*p_ply_error_cb)(p_ply ply, const char *message); * ply: handle returned by ply_open or ply_create * idata,pdata: contextual information set in ply_open or ply_create * ---------------------------------------------------------------------- */ + +RPLY_DLL_DEF int ply_get_ply_user_data(p_ply ply, void **pdata, long *idata); /* ---------------------------------------------------------------------- @@ -68,6 +83,8 @@ int ply_get_ply_user_data(p_ply ply, void **pdata, long *idata); * * Returns 1 if successful, 0 otherwise * ---------------------------------------------------------------------- */ + +RPLY_DLL_DEF p_ply ply_open(const char *name, p_ply_error_cb error_cb, long idata, void *pdata); @@ -78,6 +95,8 @@ p_ply ply_open(const char *name, p_ply_error_cb error_cb, long idata, * * Returns 1 if successfull, 0 otherwise * ---------------------------------------------------------------------- */ + +RPLY_DLL_DEF int ply_read_header(p_ply ply); /* ---------------------------------------------------------------------- @@ -101,6 +120,8 @@ typedef int (*p_ply_read_cb)(p_ply_argument argument); * Returns 0 if no element or no property in element, returns the * number of element instances otherwise. * ---------------------------------------------------------------------- */ + +RPLY_DLL_DEF long ply_set_read_cb(p_ply ply, const char *element_name, const char *property_name, p_ply_read_cb read_cb, void *pdata, long idata); @@ -115,6 +136,8 @@ long ply_set_read_cb(p_ply ply, const char *element_name, * * Returns 1 if successfull, 0 otherwise * ---------------------------------------------------------------------- */ + +RPLY_DLL_DEF int ply_get_argument_element(p_ply_argument argument, p_ply_element *element, long *instance_index); @@ -128,6 +151,8 @@ int ply_get_argument_element(p_ply_argument argument, * * Returns 1 if successfull, 0 otherwise * ---------------------------------------------------------------------- */ + +RPLY_DLL_DEF int ply_get_argument_property(p_ply_argument argument, p_ply_property *property, long *length, long *value_index); @@ -139,6 +164,8 @@ int ply_get_argument_property(p_ply_argument argument, * * Returns 1 if successfull, 0 otherwise * ---------------------------------------------------------------------- */ + +RPLY_DLL_DEF int ply_get_argument_user_data(p_ply_argument argument, void **pdata, long *idata); @@ -149,6 +176,8 @@ int ply_get_argument_user_data(p_ply_argument argument, void **pdata, * * Returns the current data item * ---------------------------------------------------------------------- */ + +RPLY_DLL_DEF double ply_get_argument_value(p_ply_argument argument); /* ---------------------------------------------------------------------- @@ -159,6 +188,8 @@ double ply_get_argument_value(p_ply_argument argument); * * Returns 1 if successfull, 0 otherwise * ---------------------------------------------------------------------- */ + +RPLY_DLL_DEF int ply_read(p_ply ply); /* ---------------------------------------------------------------------- @@ -170,6 +201,8 @@ int ply_read(p_ply ply); * * Returns element if successfull or NULL if no more elements * ---------------------------------------------------------------------- */ + +RPLY_DLL_DEF p_ply_element ply_get_next_element(p_ply ply, p_ply_element last); /* ---------------------------------------------------------------------- @@ -181,6 +214,8 @@ p_ply_element ply_get_next_element(p_ply ply, p_ply_element last); * * Returns comment if successfull or NULL if no more comments * ---------------------------------------------------------------------- */ + +RPLY_DLL_DEF const char *ply_get_next_comment(p_ply ply, const char *last); /* ---------------------------------------------------------------------- @@ -192,6 +227,8 @@ const char *ply_get_next_comment(p_ply ply, const char *last); * * Returns obj_info if successfull or NULL if no more obj_infos * ---------------------------------------------------------------------- */ + +RPLY_DLL_DEF const char *ply_get_next_obj_info(p_ply ply, const char *last); /* ---------------------------------------------------------------------- @@ -203,6 +240,8 @@ const char *ply_get_next_obj_info(p_ply ply, const char *last); * * Returns 1 if successfull or 0 otherwise * ---------------------------------------------------------------------- */ + +RPLY_DLL_DEF int ply_get_element_info(p_ply_element element, const char** name, long *ninstances); @@ -215,6 +254,8 @@ int ply_get_element_info(p_ply_element element, const char** name, * * Returns element if successfull or NULL if no more properties * ---------------------------------------------------------------------- */ + +RPLY_DLL_DEF p_ply_property ply_get_next_property(p_ply_element element, p_ply_property last); @@ -231,6 +272,8 @@ p_ply_property ply_get_next_property(p_ply_element element, * * Returns 1 if successfull or 0 otherwise * ---------------------------------------------------------------------- */ + +RPLY_DLL_DEF int ply_get_property_info(p_ply_property property, const char** name, e_ply_type *type, e_ply_type *length_type, e_ply_type *value_type); @@ -244,6 +287,8 @@ int ply_get_property_info(p_ply_property property, const char** name, * * Returns handle to PLY file if successfull, NULL otherwise * ---------------------------------------------------------------------- */ + +RPLY_DLL_DEF p_ply ply_create(const char *name, e_ply_storage_mode storage_mode, p_ply_error_cb error_cb, long idata, void *pdata); @@ -256,6 +301,8 @@ p_ply ply_create(const char *name, e_ply_storage_mode storage_mode, * * Returns 1 if successfull, 0 otherwise * ---------------------------------------------------------------------- */ + +RPLY_DLL_DEF int ply_add_element(p_ply ply, const char *name, long ninstances); /* ---------------------------------------------------------------------- @@ -269,6 +316,8 @@ int ply_add_element(p_ply ply, const char *name, long ninstances); * * Returns 1 if successfull, 0 otherwise * ---------------------------------------------------------------------- */ + +RPLY_DLL_DEF int ply_add_property(p_ply ply, const char *name, e_ply_type type, e_ply_type length_type, e_ply_type value_type); @@ -282,6 +331,8 @@ int ply_add_property(p_ply ply, const char *name, e_ply_type type, * * Returns 1 if successfull, 0 otherwise * ---------------------------------------------------------------------- */ + +RPLY_DLL_DEF int ply_add_list_property(p_ply ply, const char *name, e_ply_type length_type, e_ply_type value_type); @@ -294,6 +345,8 @@ int ply_add_list_property(p_ply ply, const char *name, * * Returns 1 if successfull, 0 otherwise * ---------------------------------------------------------------------- */ + +RPLY_DLL_DEF int ply_add_scalar_property(p_ply ply, const char *name, e_ply_type type); /* ---------------------------------------------------------------------- @@ -304,6 +357,8 @@ int ply_add_scalar_property(p_ply ply, const char *name, e_ply_type type); * * Returns 1 if successfull, 0 otherwise * ---------------------------------------------------------------------- */ + +RPLY_DLL_DEF int ply_add_comment(p_ply ply, const char *comment); /* ---------------------------------------------------------------------- @@ -314,6 +369,8 @@ int ply_add_comment(p_ply ply, const char *comment); * * Returns 1 if successfull, 0 otherwise * ---------------------------------------------------------------------- */ + +RPLY_DLL_DEF int ply_add_obj_info(p_ply ply, const char *obj_info); /* ---------------------------------------------------------------------- @@ -324,6 +381,8 @@ int ply_add_obj_info(p_ply ply, const char *obj_info); * * Returns 1 if successfull, 0 otherwise * ---------------------------------------------------------------------- */ + +RPLY_DLL_DEF int ply_write_header(p_ply ply); /* ---------------------------------------------------------------------- @@ -337,6 +396,8 @@ int ply_write_header(p_ply ply); * * Returns 1 if successfull, 0 otherwise * ---------------------------------------------------------------------- */ + +RPLY_DLL_DEF int ply_write(p_ply ply, double value); /* ---------------------------------------------------------------------- @@ -346,13 +407,14 @@ int ply_write(p_ply ply, double value); * * Returns 1 if successfull, 0 otherwise * ---------------------------------------------------------------------- */ + +RPLY_DLL_DEF int ply_close(p_ply ply); #ifdef __cplusplus -} +} // extern 'C' #endif -#endif /* RPLY_H */ /* ---------------------------------------------------------------------- * Copyright (C) 2003-2015 Diego Nehab. All rights reserved. diff --git a/rplyfile.h b/rplyfile.h index 206e716..1b5a40e 100644 --- a/rplyfile.h +++ b/rplyfile.h @@ -9,6 +9,19 @@ * at the end of this file. * ---------------------------------------------------------------------- */ +#ifdef RPLY_SHARED_LIB + +#ifdef RPLY_BUILD_LIB +#define RPLY_DLL_DEF __declspec(dllexport) +#else +#define RPLY_DLL_DEF __declspec(dllimport) +#endif // RPLY_BUILD_LIB + +#else +#define RPLY_DLL_DEF +#endif // RPLY_SHARED_LIB + + #ifdef __cplusplus extern "C" { #endif @@ -22,6 +35,7 @@ extern "C" { * * Returns 1 if successful, 0 otherwise * ---------------------------------------------------------------------- */ +RPLY_DLL_DEF p_ply ply_open_from_file(FILE *file_pointer, p_ply_error_cb error_cb, long idata, void *pdata); @@ -35,6 +49,7 @@ p_ply ply_open_from_file(FILE *file_pointer, p_ply_error_cb error_cb, * * Returns handle to PLY file if successfull, NULL otherwise * ---------------------------------------------------------------------- */ +RPLY_DLL_DEF p_ply ply_create_to_file(FILE *file_pointer, e_ply_storage_mode storage_mode, p_ply_error_cb error_cb, long idata, void *pdata);