Skip to content

Commit

Permalink
Merge pull request #47 from Kazmirchuk/master
Browse files Browse the repository at this point in the history
update nmake files according to TIP 477
  • Loading branch information
bovine authored Jan 18, 2024
2 parents 0693f01 + eaf5110 commit acbd4e2
Show file tree
Hide file tree
Showing 11 changed files with 166 additions and 1,735 deletions.
3 changes: 3 additions & 0 deletions generic/libpgtcl.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

#include <tcl.h>

#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLEXPORT

EXTERN int Pgtcl_Init(Tcl_Interp *interp);
extern int Pgtcl_SafeInit(Tcl_Interp *interp);

Expand Down
88 changes: 19 additions & 69 deletions generic/pgtcl.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,35 +24,9 @@
#endif

#ifdef WIN32
#include <c.h>
#include <winsock2.h>
#endif

#ifdef _MSC_VER
/* Only do this when MSVC++ is compiling us. */
#ifdef USE_TCL_STUBS
/* Mark this .obj as needing tcl's Stubs library. */
#pragma comment(lib, "tclstub" \
STRINGIFY(JOIN(TCL_MAJOR_VERSION,TCL_MINOR_VERSION)) ".lib")
#if !defined(_MT) || !defined(_DLL) || defined(_DEBUG)

/*
* This fixes a bug with how the Stubs library was compiled. The
* requirement for msvcrt.lib from tclstubXX.lib should be removed.
*/
#pragma comment(linker, "-nodefaultlib:msvcrt.lib")
#endif
#else
/* Mark this .obj needing the import library */
#pragma comment(lib, "tcl" \
STRINGIFY(JOIN(TCL_MAJOR_VERSION,TCL_MINOR_VERSION)) ".lib")
#endif
#endif
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLEXPORT
/* END STUBS MUMBO JUMBO */



typedef struct {
char *name; /* Name of command. */
char *name2; /* Name of command, in ::pg namespace. */
Expand Down Expand Up @@ -115,55 +89,31 @@ static PgCmd commands[] = {
EXTERN int
Pgtcl_Init(Tcl_Interp *interp)
{
double tclversion;
Tcl_Obj *tclVersionObj;
PgCmd *cmdPtr;
double tclversion;
Tcl_Obj *tclVersionObj;
PgCmd *cmdPtr;

#ifdef WIN32
WSADATA wsaData;
#endif
#ifdef WIN32
WSADATA wsaData;
#endif

#ifdef USE_TCL_STUBS
if (Tcl_InitStubs(interp, "8.1", 0) == NULL)
return TCL_ERROR;
#endif

#ifdef WIN32X
/*
* On Windows, need to explicitly load the libpq library to
* force the call to WSAStartup.
*/
Tcl_Obj *tresult;

if (LoadLibrary("libpq.dll") == NULL) {
//char buf[32];
//sprintf(buf, "%d", GetLastError());
tresult = Tcl_NewStringObj("Cannot load \"libpq.dll\" (or dependant), error was ");
Tcl_AppendToObj(tresult, GetLastError(), -1);
Tcl_SetObjResult(interp, tresult);

/*
Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
"Cannot load \"libpq.dll\" (or dependant), error was ",
GetLastError(), NULL);
*/

return TCL_ERROR;
}
#endif

#ifdef WIN32

if (WSAStartup(MAKEWORD(1, 1), &wsaData))
{
/*
* No really good way to do error handling here, since we
* don't know how we were loaded
*/
return TCL_ERROR;
}

#endif
#ifdef WIN32

if (WSAStartup(MAKEWORD(1, 1), &wsaData))
{
/*
* No really good way to do error handling here, since we
* don't know how we were loaded
*/
return TCL_ERROR;
}

#endif


/*
Expand Down
8 changes: 0 additions & 8 deletions libpgtcl.def

This file was deleted.

1 change: 0 additions & 1 deletion postgres-helpers.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

package provide sc_postgres 1.3

package require Tclx
package require Pgtcl

namespace eval sc_pg {
Expand Down
230 changes: 0 additions & 230 deletions win/libpgtcl.dsp

This file was deleted.

29 changes: 0 additions & 29 deletions win/libpgtcl.dsw

This file was deleted.

Loading

0 comments on commit acbd4e2

Please sign in to comment.