arcapos / luapgsql

Lua binding for PostgreSQL
108 stars 24 forks source link

Added support for Windows platform #48

Closed mrkskwsnck closed 3 years ago

mrkskwsnck commented 6 years ago

The compiler used was GCC from the MinGW64 toolchain. The method used to switch endianness is defined in ia32intrin.h but called through x86intrin.h headers.

mrkskwsnck commented 6 years ago

@daurnimator The function htonll is not defined with MinGW64 and GCC, so I implemented the latter alternative.

daurnimator commented 6 years ago

@MrksKwsnck can you confirm the current code works with both mingw and msvc?

daurnimator commented 6 years ago

Otherwise, could you remove your redundant commits from this PR?

mrkskwsnck commented 6 years ago

Unfortunately, it does not compile using MSVC :-(

C:\luapgsql>cl /nologo /MD /O2 -c -Foluapgsql.obj -IC:/lua/include luapgsql.c -IC:\pgsql\include
luapgsql.c
luapgsql.c(194): warning C4090: "Funktion": Unterschiedliche "const"-Qualifizierer

C:\luapgsql>link -dll -def:pgsql.def -out:pgsql.dll C:/lua/lua53.dll luapgsql.obj -libpath:C:\pgsql/lib pq.lib
Microsoft (R) Incremental Linker Version 14.11.25547.0
Copyright (C) Microsoft Corporation.  All rights reserved.

C:/lua/lua53.dll : fatal error LNK1107: Ungültige oder beschädigte Datei: Lesen bei 0x430 nicht möglich.

I tried compiling using Microsoft Visual Studio Build Tools 2017. As I am not experienced in working with MSVC, I need to investigate the issue.

mrkskwsnck commented 6 years ago

Some time has passed and what I have managed so far is to successfully compile using MSVC (Microsoft Visual Studio Build Tools 2017). However, I still was not able to test the resulting DLL file properly, because it lacks some more dependencies (also the Dependency Walker was not helpful here).

mbalmer commented 3 years ago

Sorry for not acting on this earlier, but it looks your diff does not apply anymore. Please re-submit agains current sources if windows support is still wanted.