improve win32 support
This commit is contained in:
parent
80315e1be3
commit
30995ce506
11
C/load_dll.c
11
C/load_dll.c
@ -36,7 +36,15 @@ Yap_FindExecutable(void)
|
|||||||
void *
|
void *
|
||||||
Yap_LoadForeignFile(char *file, int flags)
|
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
|
int
|
||||||
@ -78,6 +86,7 @@ LoadForeign(StringList ofiles, StringList libs,
|
|||||||
NULL, GetLastError(),
|
NULL, GetLastError(),
|
||||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), LOCAL_ErrorSay, 256,
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), LOCAL_ErrorSay, 256,
|
||||||
NULL);
|
NULL);
|
||||||
|
//fprintf(stderr,"WinError: %s\n", LOCAL_ErrorSay);
|
||||||
}
|
}
|
||||||
ofiles = ofiles->next;
|
ofiles = ofiles->next;
|
||||||
}
|
}
|
||||||
|
1
C/load_foreign.c
Normal file → Executable file
1
C/load_foreign.c
Normal file → Executable file
@ -136,6 +136,7 @@ p_open_shared_object( USES_REGS1 ) {
|
|||||||
|
|
||||||
s = RepAtom(AtomOfTerm(t))->StrOfAE;
|
s = RepAtom(AtomOfTerm(t))->StrOfAE;
|
||||||
if ((handle = Yap_LoadForeignFile(s, IntegerOfTerm(tflags)))==NULL) {
|
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;
|
return FALSE;
|
||||||
} else {
|
} else {
|
||||||
return Yap_unify(MkIntegerTerm((Int)handle),ARG3);
|
return Yap_unify(MkIntegerTerm((Int)handle),ARG3);
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include <windows/uxnt.h>
|
#include <windows/uxnt.h>
|
||||||
#define O_HASDRIVES 1
|
#define O_HASDRIVES 1
|
||||||
#define O_HASSHARES 1
|
#define O_HASSHARES 1
|
||||||
|
#define EMULATE_DLOPEN 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__GNUC__) && !defined(MAY_ALIAS)
|
#if defined(__GNUC__) && !defined(MAY_ALIAS)
|
||||||
|
@ -694,7 +694,7 @@ PRED_IMPL("win_add_dll_directory", 2, win_add_dll_directory, 0)
|
|||||||
if ( _xos_os_filenameW(dirs, dirw, len+10) == NULL )
|
if ( _xos_os_filenameW(dirs, dirw, len+10) == NULL )
|
||||||
return PL_representation_error("file_name");
|
return PL_representation_error("file_name");
|
||||||
if ( load_library_search_flags() )
|
if ( load_library_search_flags() )
|
||||||
{ if ( (cookie = (*f_AddDllDirectoryW)(dirw)) )
|
{ if ( (cookie = (*f_AddDllDirectoryW)(dirw)) )
|
||||||
return PL_unify_int64(A2, (int64_t)cookie);
|
return PL_unify_int64(A2, (int64_t)cookie);
|
||||||
return PL_error(NULL, 0, WinError(), ERR_SYSCALL, "AddDllDirectory()");
|
return PL_error(NULL, 0, WinError(), ERR_SYSCALL, "AddDllDirectory()");
|
||||||
} else
|
} else
|
||||||
|
Reference in New Issue
Block a user