Subject: Re: vswprintf implementation (need floating point support) by salass00 on 2019/10/13 20:35:04
@kas1e
Quote: Thanks a bunch! Checked library : with gcc it works, with g++ not, saing about undefs. I assume there need some C++ guards as usually inside of libwprinf.h ? Maybe forgotten extern "C" or something ?
Change the libwprintf.h header to:
#ifndef LIBWPRINTF_H
#define LIBWPRINTF_H
#include <stdio.h>
#include <stdarg.h>
#include <wchar.h>
#ifdef __cplusplus
extern "C" {
#endif
int swprintf(wchar_t *buffer, size_t maxlen, const wchar_t *fmt, ...);
int vswprintf(wchar_t *buffer, size_t maxlen, const wchar_t *fmt, va_list ap);
int fwprintf(FILE *fp, const wchar_t *fmt, ...);
int vfwprintf(FILE *fp, const wchar_t *fmt, va_list ap);
#ifdef __cplusplus
}
#endif
#endif
and it will work with C++ too.
As I code mainly in plain C I tend to forget such things.
|