libraw wide char format support on MSYS2

Dear all,
I'm developing a software that uses libraw. This software is multi-platform and is able to run on GNU/Linux, OS X, FreeBSD and Windows through MSYS2.
Indeed, libraw is available on MSYS2 and that makes things easy. However there's a small issue that is kind of annoying: I cannot use the function

libraw_open_wfile

as I would like to do. For example with libtiff i use TIFFOpenW.

Indeed, in libraw.h this line:

#if defined(_WIN32) && !defined(__MINGW32__) && defined(_MSC_VER) && (_MSC_VER > 1310)

make the function unavailable on MSYS2. However, this function should work on every Windows system because it is not possible for now to use wide chars as "é" "è" or others in filename.

So, do you think it could be possible for you to fix this issue in a next release ? I understand it may not be your priority but as libraw is available on MSYS2 I really think it should be fixed.

Or maybe you have a workaround to open filename with wide chars.

My best regards

Forums: 

This code line is because

This code line is because some (old) versions of MinGW does not support wide chars in file opening interface.
If that has changed, this line should be changed too (with compiler/runtime/whatever version check).
We're open to contributions, so if you could investigate the problem in depth (what versions/runtimes works with wchar_t and what is not), just propose patch.

Alternatively, you may create own Libraw datastream implementation and pass it to LibRaw.

-- Alex Tutubalin @LibRaw LLC

OK I will try to investigate,

OK I will try to investigate, but I tried to compile libraw on MSYS2 with no sucess.

I've a lot of

src/libraw_c_api.cpp:373:14: warning: 'int libraw_get_iwidth(libraw_data_t*)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
src/libraw_c_api.cpp:380:16: error: function 'float libraw_get_cam_mul(libraw_data_t*, int)' definition is marked dllimport
   DllDef float libraw_get_cam_mul(libraw_data_t *lr, int index)

Makefile.mingw builds LibRaw

Makefile.mingw builds LibRaw with -DLIBRAW_NODLL, so DllDef is defined empty

-- Alex Tutubalin @LibRaw LLC

I can not understand the

I can not understand the question. What feature you want to disable?

-- Alex Tutubalin @LibRaw LLC

Sorry I think I misunderstood

Sorry I think I misunderstood.
The problem is because the error I cannot compile the lib to test it. I thought you told me by removing the flag it would be ok.
Sorry,

Makefile.mingw already

Makefile.mingw already defines -DLIBRAW_NODLL, so disabling DllDef (and, of course, DLL builds):

DllDef is defined in libraw_types.h:
#ifdef WIN32
#ifdef LIBRAW_NODLL
#define DllDef
#else
#ifdef LIBRAW_BUILDLIB
#define DllDef __declspec(dllexport)
#else
#define DllDef __declspec(dllimport)
#endif
#endif
#else
#define DllDef
#endif

-- Alex Tutubalin @LibRaw LLC

example of libtiff

Also, I took a look to the code of libtiff that is also included in msys2:

#ifdef __WIN32__
#include <windows.h>
/*
 * Open a TIFF file with a Unicode filename, for read/writing.
 */
TIFF*
TIFFOpenW(const wchar_t* name, const char* mode)
{
	static const char module[] = "TIFFOpenW";
	int m, fd;
	int mbsize;
	char *mbname;
	TIFF* tif;
 
	m = _TIFFgetMode(mode, module);
	if (m == -1)
		return ((TIFF*)0);