The problem is in the ecs_OpenDynamicLib
function (in ecs_dyna.c
) within the #ifdef _WINDOWS
block. The check for failed load looks like this:
if ((int) handle <= (int) HINSTANCE_ERROR) { // ... Handle LoadLibrary failure }
On 64 bit Windows, LoadModule
returns a 64 bit value, but int
is 32 bit. Casting to (signed) int
drops the high 32 bits. The low 32 bits, interpreted as an int
can be negative, causing OGDI to think the load failed.
From reading the MSDN docs for LoadModule, it would seem that the correct check should be like this:
if (handle == NULL) { // ... Handle LoadLibrary failure }
Fixed in
Checking in ogdi/c-api/ecs_dyna.c;
/cvsroot/ogdi/devdir/ogdi/c-api/ecs_dyna.c,v <-- ecs_dyna.c
new revision: 1.6; previous revision: 1.5