+YAZ_BEGIN_CDECL
+
+/** \brief a yaz_marc_t handle (private content) */
+typedef struct yaz_marc_t_ *yaz_marc_t;
+
+/** \brief construct yaz_marc_t handle */
+YAZ_EXPORT yaz_marc_t yaz_marc_create(void);
+
+/** \brief destroy yaz_marc_t handle */
+YAZ_EXPORT void yaz_marc_destroy(yaz_marc_t mt);
+
+/** \brief set XML mode YAZ_MARC_LINE, YAZ_MARC_SIMPLEXML, ... */
+YAZ_EXPORT void yaz_marc_xml(yaz_marc_t mt, int xmlmode);
+
+/** \brief Output format: Line-format */
+#define YAZ_MARC_LINE 0
+/** \brief Output format: simplexml (no longer supported) */
+#define YAZ_MARC_SIMPLEXML 1
+/** \brief Output format: OAI-MARC (no longer supported) */
+#define YAZ_MARC_OAIMARC 2
+/** \brief Output format: MARCXML */
+#define YAZ_MARC_MARCXML 3
+/** \brief Output format: ISO2709 */
+#define YAZ_MARC_ISO2709 4
+/** \brief Output format: MarcXchange */
+#define YAZ_MARC_XCHANGE 5
+
+/** \brief supply iconv handle for character set conversion .. */
+YAZ_EXPORT void yaz_marc_iconv(yaz_marc_t mt, yaz_iconv_t cd);
+
+/** \brief set debug level
+ \param mt handle
+ \param level level, where 0=lowest, 1 more debug, 2 even more
+*/
+YAZ_EXPORT void yaz_marc_debug(yaz_marc_t mt, int level);
+
+/** \brief decodes ISO2709 buffer using straight buffers
+ \param mt marc handle
+ \param buf input buffer
+ \param bsize size of buffer or (-1 if "any size")
+ \param result result to be stored here (allocate before use!)
+ \param rsize size of result (set before calling)
+
+ Decodes MARC in buf of size bsize.
+ On success, result in *result with size *rsize.
+ Returns -1 on error, or size of input record (>0) if OK
+*/
+YAZ_EXPORT int yaz_marc_decode_buf(yaz_marc_t mt, const char *buf, int bsize,
+ char **result, int *rsize);
+
+/** \brief decodes ISO2709/MARC buffer and stores result in WRBUF
+ \param mt handle
+ \param buf input buffer
+ \param bsize size of buffer (-1 if "any size")
+ \param wrbuf WRBUF for output