Re: What is swipl's default DLL search path on Windows?

Haitao Zhang <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CAFUyvhpC8WR4xvDio8qVA2G6Zxq+-HEVupapVWZaXzUxmqDeoQ@mail.gmail.com>
Jan,

Thanks! win_add_dll_directory worked great out of the box!
I will take a look of the swipl-ld source and see what I can do.

Haitao



On Sat, Feb 1, 2014 at 12:52 AM, Jan Wielemaker <[email protected]> wrote:

> On 02/01/2014 07:06 AM, Haitao Zhang wrote:
> > I am compiling an extension that depends on libgcc and libstdc++. I get
> > module not found errors for libgcc and libstdc++ when use_foreign_library
> > even though the DLLs are in the first directory of the PATH. If I compile
> > with -static-libgcc and -static-libstdc++ the errors go away.
> >
> > I wonder if swipl controls where the DLLs are searched for or if this is
> > controlled by Windows?
>
> That is a very difficult story.  The best pointer into it is
>
>   http://www.swi-prolog.org/pldoc/doc_for?object=win_add_dll_directory/2
>
> The intend is that use_foreign_library/1 uses absolute_file_name/3 to
> locate the target and calls  LoadLibraryEx() such that this also searches
> in the directory of the DLL for dependencies.  If Prolog cannot find the
> file using absolute_file_name/3, it just calls LoadLibraryEx() using the
> base name of the file and leaves the search entirely to the OS.
>
> What really happens depends on the Windows version.  Study LoadLibraryEx()
> and the source code if you want to understand all the details.  The docs
> contain so many `if's that it is hard to tell a clear story.
>
> > Another observation: when using swipl-ld I must specify at least one .c
> or
> > .cc file. I can't seem to just use it to invoke the linker on .o files
> > only. I can work around by observing the -v output and invoke the gcc/g++
> > myself but it seems that one should be able to use swipl-ld for linking
> > only? Also if one specifies g++ to be the compiler the default linker is
> > still gcc. But if one specifies g++ to be the linker the compiler gets
> set
> > to be g++ as well.
>
> Seems like a dubious feature.  Please consider submitting a patch.  Sources
> are in src/swipl-ld.c.
>
> Sorry for the somewhat unclear answer
>
>         Cheers --- Jan
>
-------------- next part --------------
HTML attachment scrubbed and removed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.