Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/sundown-ffi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--html/html.h8
-rw-r--r--src/buffer.h28
-rw-r--r--src/markdown.c2
-rw-r--r--src/markdown.h14
4 files changed, 32 insertions, 20 deletions
diff --git a/html/html.h b/html/html.h
index 5152caf..678c162 100644
--- a/html/html.h
+++ b/html/html.h
@@ -57,16 +57,16 @@ typedef enum {
HTML_TAG_CLOSE,
} html_tag;
-int
+SD_EXPORT int
sd_html_is_tag(const uint8_t *tag_data, size_t tag_size, const char *tagname);
-extern void
+extern SD_EXPORT void
sd_html_renderer(struct sd_callbacks *callbacks, struct sd_html_renderopt *options_ptr, unsigned int render_flags);
-extern void
+extern SD_EXPORT void
sd_html_toc_renderer(struct sd_callbacks *callbacks, struct sd_html_renderopt *options_ptr);
-extern void
+extern SD_EXPORT void
sd_html_smartypants(struct sd_buf *ob, const uint8_t *text, size_t size);
#ifdef __cplusplus
diff --git a/src/buffer.h b/src/buffer.h
index 3b45600..3268e6e 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -22,6 +22,12 @@
#include <stdarg.h>
#include <stdint.h>
+#ifdef _WIN32
+#define SD_EXPORT __declspec(dllexport)
+#else
+#define SD_EXPORT
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -57,37 +63,37 @@ struct sd_buf {
sd_bufput(output, literal, sizeof literal - 1)
/* bufgrow: increasing the allocated size to the given value */
-int sd_bufgrow(struct sd_buf *, size_t);
+SD_EXPORT int sd_bufgrow(struct sd_buf *, size_t);
/* bufnew: allocation of a new buffer */
-struct sd_buf *sd_bufnew(size_t) __attribute__ ((malloc));
+SD_EXPORT struct sd_buf *sd_bufnew(size_t) __attribute__ ((malloc));
/* bufnullterm: NUL-termination of the string array (making a C-string) */
-const char *sd_bufcstr(struct sd_buf *);
+SD_EXPORT const char *sd_bufcstr(struct sd_buf *);
/* bufprefix: compare the beginning of a buffer with a string */
-int sd_bufprefix(const struct sd_buf *buf, const char *prefix);
+SD_EXPORT int sd_bufprefix(const struct sd_buf *buf, const char *prefix);
/* bufput: appends raw data to a buffer */
-void sd_bufput(struct sd_buf *, const void *, size_t);
+SD_EXPORT void sd_bufput(struct sd_buf *, const void *, size_t);
/* bufputs: appends a NUL-terminated string to a buffer */
-void sd_bufputs(struct sd_buf *, const char *);
+SD_EXPORT void sd_bufputs(struct sd_buf *, const char *);
/* bufputc: appends a single char to a buffer */
-void sd_bufputc(struct sd_buf *, int);
+SD_EXPORT void sd_bufputc(struct sd_buf *, int);
/* bufrelease: decrease the reference count and free the buffer if needed */
-void sd_bufrelease(struct sd_buf *);
+SD_EXPORT void sd_bufrelease(struct sd_buf *);
/* bufreset: frees internal data of the buffer */
-void sd_bufreset(struct sd_buf *);
+SD_EXPORT void sd_bufreset(struct sd_buf *);
/* bufslurp: removes a given number of bytes from the head of the array */
-void sd_bufslurp(struct sd_buf *, size_t);
+SD_EXPORT void sd_bufslurp(struct sd_buf *, size_t);
/* bufprintf: formatted printing to a buffer */
-void sd_bufprintf(struct sd_buf *, const char *, ...) __attribute__ ((format (printf, 2, 3)));
+SD_EXPORT void sd_bufprintf(struct sd_buf *, const char *, ...) __attribute__ ((format (printf, 2, 3)));
#ifdef __cplusplus
}
diff --git a/src/markdown.c b/src/markdown.c
index 0a65d08..0ee1fba 100644
--- a/src/markdown.c
+++ b/src/markdown.c
@@ -2557,5 +2557,5 @@ sd_version(int *ver_major, int *ver_minor, int *ver_revision)
#if defined(_MSC_VER)
#include "lua.h"
-int __declspec(dllexport) __cdecl luaopen_libsundown(lua_State* L) { return 0; }
+SD_EXPORT int luaopen_libsundown(lua_State* L) { return 0; }
#endif
diff --git a/src/markdown.h b/src/markdown.h
index 87d0dfc..34587f3 100644
--- a/src/markdown.h
+++ b/src/markdown.h
@@ -31,6 +31,12 @@ extern "C" {
#define SUNDOWN_VER_MINOR 16
#define SUNDOWN_VER_REVISION 0
+#ifdef _WIN32
+#define SD_EXPORT __declspec(dllexport)
+#else
+#define SD_EXPORT
+#endif
+
/********************
* TYPE DEFINITIONS *
********************/
@@ -113,20 +119,20 @@ struct sd_markdown;
* EXPORTED FUNCTIONS *
**********************/
-extern struct sd_markdown *
+extern SD_EXPORT struct sd_markdown *
sd_markdown_new(
unsigned int extensions,
size_t max_nesting,
const struct sd_callbacks *callbacks,
void *opaque);
-extern void
+extern SD_EXPORT void
sd_markdown_render(struct sd_buf *ob, const uint8_t *document, size_t doc_size, struct sd_markdown *md);
-extern void
+extern SD_EXPORT void
sd_markdown_free(struct sd_markdown *md);
-extern void
+extern SD_EXPORT void
sd_version(int *major, int *minor, int *revision);
#ifdef __cplusplus