| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-Original-To: | cygwin AT cygwin DOT com |
| Delivered-To: | cygwin AT cygwin DOT com |
| DMARC-Filter: | OpenDMARC Filter v1.4.1 sourceware.org 888AA385803E |
| Authentication-Results: | sourceware.org; |
| dmarc=pass (p=none dis=none) header.from=gmail.com | |
| Authentication-Results: | sourceware.org; spf=pass smtp.mailfrom=gmail.com |
| DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; |
| h=mime-version:from:date:message-id:subject:to; | |
| bh=BdEcAYqjqFL1yuZLEkwX8yW8eoUcW9ei+NrWrVycZGY=; | |
| b=lsOxsByfNo9pEq1Eevaj4J1sHUtZsjJFTabOp3RLyF1zRCANtNDswg9xlUPI++4U+I | |
| MWi/lCgvpJ0iC3Y6wNhGcq/jpIngd7QFG0KWlufwQrVYllr/kCuIMDaYN1aMQzSil/3d | |
| AchfcburbkafaCy13C4wWI+v6ytqKX/jJnQWtkNf9G4VLoXeg3RPiQjH3+gmH37qbIWi | |
| typ57gB+Sd7x/MnF7U1kQPWz0WuxnEu5V9+ZFhEs/Zc5m0sG7QUa0ImxBMDpj6FAwr+I | |
| U8NlHZBgu4AEtEbxctNBHirkh8uCGI2NRUx9qMzaqObrNvI3XFXTLMB8eXnobVbFycFy | |
| 9HQw== | |
| X-Google-DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; |
| d=1e100.net; s=20210112; | |
| h=x-gm-message-state:mime-version:from:date:message-id:subject:to; | |
| bh=BdEcAYqjqFL1yuZLEkwX8yW8eoUcW9ei+NrWrVycZGY=; | |
| b=jrm1eafzj88OedLLVbRJeNz1lWjFbiEge/uxJOUJLCvZuK7h9dw5ueTudEZ8NoSHeO | |
| IYVxAQx906Qs2Fz+fgJW4Sl/Qc7SY5wVr0rWtBJD3tJs647qafUiaZIgp9DXGErCIccn | |
| w2dBI6z5CQCAAlyt8sb7WWPi1o8RcbYWkv4K4vg/uGHo1l85RWyPuAScpOKer5zwPyPz | |
| Y9Gy/9aOLqmXJb65g4m4iIp+K/xhDVSGu1A4aoDoDPExE3cOkA/p21irW+mXni9Hjumi | |
| ZgoN1lkOdFssayo0WJ/SxUg6dTKDrh7jbV59WA7K5qP7nw5xNYXb7YvgaSnN8YhezJig | |
| 1REA== | |
| X-Gm-Message-State: | AOAM532N/T3/IDfob13p32D2EBYHy0NnRozQhlVgcFw3qs2GBdJkg9G6 |
| A2ydabLscGTa3Xe4ykIbNcBmvc8cK/WwlDqwRKZx2xYdX7W7dQ== | |
| X-Google-Smtp-Source: | ABdhPJwhHGKEDuS9LbpsbzPYvEgDvVqXZpY+tm3XGsFtblZQzRAIK7a00+rzhTxHWgorR0pyJRzETRSZgN4XNreoyjU= |
| X-Received: | by 2002:a05:6000:1866:b0:20f:c0d2:a25c with SMTP id |
| d6-20020a056000186600b0020fc0d2a25cmr13591053wri.457.1653341729881; Mon, 23 | |
| May 2022 14:35:29 -0700 (PDT) | |
| MIME-Version: | 1.0 |
| From: | Yclept Nemo <orbisvicis AT gmail DOT com> |
| Date: | Mon, 23 May 2022 17:35:21 -0400 |
| Message-ID: | <CALurfZUpje9LG6ve324ORxtmtWEt+rfofvg9pDF6p1zw8RLAEQ@mail.gmail.com> |
| Subject: | Unable to use SetDefaultDllDirectories/LOAD_LIBRARY_SEARCH_USER_DIRS |
| To: | cygwin AT cygwin DOT com |
| X-Spam-Status: | No, score=-0.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, |
| DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, | |
| RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, | |
| T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 | |
| X-Spam-Checker-Version: | SpamAssassin 3.4.6 (2021-04-09) on |
| server2.sourceware.org | |
| X-Content-Filtered-By: | Mailman/MimeDel 2.1.29 |
| X-BeenThere: | cygwin AT cygwin DOT com |
| X-Mailman-Version: | 2.1.29 |
| List-Id: | General Cygwin discussions and problem reports <cygwin.cygwin.com> |
| List-Archive: | <https://cygwin.com/pipermail/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-request AT cygwin DOT com?subject=help> |
| List-Subscribe: | <https://cygwin.com/mailman/listinfo/cygwin>, |
| <mailto:cygwin-request AT cygwin DOT com?subject=subscribe> | |
| Sender: | "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com> |
I'm trying to add a new DLL search path. I don't have any problems with
'SetDllDirectory' but I cannot use it as the directory is not permanent; a
subsequent call will remove it. The function 'SetDefaultDllDirectories'
offers
many configuration flags, the ones I care about are:
LOAD_LIBRARY_SEARCH_DEFAULT_DIRS
LOAD_LIBRARY_SEARCH_SYSTEM32
LOAD_LIBRARY_SEARCH_APPLICATION_DIR
LOAD_LIBRARY_SEARCH_USER_DIRS
LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR
If DLL_LOAD_DIR is set then cygwin DLL lookups work as usual but any
directories added with 'AddDllDirectory' are ignored. If DLL_LOAD_DIR is not
set, then cygwin DLLs cannot be found. To use SEARCH_USER_DIRS I must omit
DLL_LOAD_DIR as well as reimplement cygwin DLL lookup by adding every
directory
(recursively) beneath "/usr/lib" and "/usr/bin" (using 'AddDllDirectory') as
well as the directory I initially wanted to add. Which at 1687 directories
is
not ideal.
I am testing with "_umath_linalg.cpython-38-x86_64-cygwin.dll" (from numpy)
and
"vtkCommonCore.cpython-38-x86_64-cygwin.dll" from VTK, both copied to a test
directory. The missing VTK libraries exist in the directory I wish to add.
They
are python modules and the module loading process is not compatible with
'SetDllDirectory'.
$ ldd _umath_linalg.cpython-38-x86_64-cygwin.dll
...
cygblas-0.dll => /usr/bin/cygblas-0.dll (0x3da3a0000)
cyglapack-0.dll => /usr/lib/lapack/cyglapack-0.dll (0x3b8040000)
...
$ ldd vtkCommonCore.cpython-38-x86_64-cygwin.dll
...
vtkCommonCore.cpython-38-x86_64-cygwin.dll =>
/.../test/vtkCommonCore.cpython-38-x86_64-cygwin.dll (0x522a10000)
cygvtkCommonCore.dll => not found
cygvtkWrappingPythonCore3.8.dll => not found
cygvtksys.dll => not found
...
This is my test program:
#include <stdlib.h>
#include <stdio.h>
#include <dlfcn.h>
#include <Windows.h>
#include <libloaderapi.h>
int main(int argc, char** argv) {
//SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR);
//SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR |
LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
//SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
//SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS |
LOAD_LIBRARY_SEARCH_USER_DIRS);
SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS |
LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR);
//SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_USER_DIRS);
//SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_USER_DIRS |
LOAD_LIBRARY_SEARCH_SYSTEM32);
//SetDefaultDllDirectories(LOAD_WITH_ALTERED_SEARCH_PATH);
// Cygwin paths do not work
//AddDllDirectory(L"/bin");
//AddDllDirectory(L"/lib");
//AddDllDirectory(L"/usr/bin");
//AddDllDirectory(L"/usr/lib");
//AddDllDirectory(L"/usr/lib/lapack");
//AddDllDirectory(L"/cygdrive/c/WINDOWS");
//AddDllDirectory(L"/cygdrive/c/WINDOWS/SYSTEM32");
//AddDllDirectory(L"/cygdrive/c/Users/.../test");
//AddDllDirectory(L"/cygdrive/c/Users/.../pyvenv38/lib/python3.8/site-packages/vtkmodules");
AddDllDirectory(L"C:\\cygwin64\\bin");
AddDllDirectory(L"C:\\cygwin64\\lib");
//AddDllDirectory(L"C:\\cygwin64\\lib\\lapack");
//AddDllDirectory(L"C:\\Windows");
//AddDllDirectory(L"C:\\Windows\\System32");
//AddDllDirectory(L"C:\\Users\\...\\test");
AddDllDirectory(L"C:\\Users\\...\\pyvenv38\\lib\\python3.8\\site-packages\\vtkmodules");
//SetDllDirectoryW(L"C:\\Users\\...\\pyvenv38\\lib\\python3.8\\site-packages\\vtkmodules");
if (argc != 2) {
printf("Error: one argument accepted: filepath to a DLL\n");
return 2;
}
if (!argv[1][0]) {
printf("Error: Path must not be empty\n");
return 2;
}
printf("Testing dlopen with '%s'\n", argv[1]);
void* sh = LoadLibraryA(argv[1]);
//void* sh = LoadLibraryEx(argv[1], NULL, 0x0);
//void* sh = dlopen(argv[1], RTLD_NOW);
if (!sh) {
char* dle = dlerror();
printf("Symbol table handle was null: %s\n", dle);
return 1;
}
else {
printf("Succeeded: not null\n");
return 0;
}
}
Please advise.
Thanks,
--
Problem reports: https://cygwin.com/problems.html
FAQ: https://cygwin.com/faq/
Documentation: https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |