maparent / virtuoso-python

RDFLib and SQLAlchemy bindings for Virtuoso
BSD 3-Clause "New" or "Revised" License
16 stars 10 forks source link

pyodbc v4-virtuoso build error #17

Open danizen opened 6 years ago

danizen commented 6 years ago

On Windows 7 with Microsoft Visual Studio 2015 and Python 3.5.1, I have these build errors out of the box:

src\virtuoso.cpp(17): error C3861: 'strncasecmp': identifier not found
src\virtuoso.cpp(54): error C3861: 'wcsncasecmp': identifier not found
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\amd64\\cl.exe' failed with exit status 2

I observe that in src\pyodbc.h, there is a macro defined for strcasecmp when _MSC_VER is not defined. Going the other way to avoid impacts on upstream, I added the following to src\virtuoso.h:

#ifdef _MSC_VER
#  define strcasecmp _stricmp
#  define strncasecmp _strnicmp
#endif

This leaves wcsncasecmp - I cannot figure out easily from Dr. Google how this should be solved, especially as wchar_t is only 16-bits on windows. I will do my development in vagrant or on a server, and I suspect this will work, but I will want eventually to be able to do this from Windows as well - most of the developers here work from Windows, and I'm an exception in being able to use vagrant (and also dabble in C/C++ even though I don't write in it any longer).

xjtusedy commented 5 years ago

On Windows, maybe you can use '_strnicmp' and '_wcsnicmp', which may work.

danizen commented 5 years ago

@xjtusedy , I think I already succeeded in building it by changing the tests on MSC_VER to build it, or maybe that was another package. In any case, I think I'm good now.