improve win32 support

This commit is contained in:
U-vsc-PC\vsc 2013-11-11 10:32:55 +00:00
parent 80315e1be3
commit 30995ce506
4 changed files with 13 additions and 2 deletions

View File

@ -36,7 +36,15 @@ Yap_FindExecutable(void)
void *
Yap_LoadForeignFile(char *file, int flags)
{
return (void *)LoadLibrary(file);
void *ptr= (void *)LoadLibrary(file);
if (!ptr) {
LOCAL_ErrorSay[0]='\0';
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), LOCAL_ErrorSay, 256,
NULL);
}
return ptr;
}
int
@ -78,6 +86,7 @@ LoadForeign(StringList ofiles, StringList libs,
NULL, GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), LOCAL_ErrorSay, 256,
NULL);
//fprintf(stderr,"WinError: %s\n", LOCAL_ErrorSay);
}
ofiles = ofiles->next;
}

1
C/load_foreign.c Normal file → Executable file
View File

@ -136,6 +136,7 @@ p_open_shared_object( USES_REGS1 ) {
s = RepAtom(AtomOfTerm(t))->StrOfAE;
if ((handle = Yap_LoadForeignFile(s, IntegerOfTerm(tflags)))==NULL) {
Yap_Error(EXISTENCE_ERROR_SOURCE_SINK,t,"open_shared_object_failed for %s with %s\n", s, LOCAL_ErrorSay);
return FALSE;
} else {
return Yap_unify(MkIntegerTerm((Int)handle),ARG3);

View File

@ -10,6 +10,7 @@
#include <windows/uxnt.h>
#define O_HASDRIVES 1
#define O_HASSHARES 1
#define EMULATE_DLOPEN 1
#endif
#if defined(__GNUC__) && !defined(MAY_ALIAS)