This is the mail archive of the
cygwin
mailing list for the Cygwin project.
No error messages printed out within Windows Command Prompt when shared libraries are not found
- From: Luca <lucatrv at hotmail dot com>
- To: "cygwin at cygwin dot com" <cygwin at cygwin dot com>
- Date: Tue, 17 Oct 2017 21:41:05 +0000
- Subject: No error messages printed out within Windows Command Prompt when shared libraries are not found
- Authentication-results: sourceware.org; auth=none
- Authentication-results: outbound.protection.outlook.com; spf=skipped (originating message); dkim=none (message not signed) header.d=none; dmarc=none action=none header.from=hotmail.com;
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On Linux, if I run a program compiled with 'gcc' without the proper shared libraries in path I get the following error message:
> error while loading shared libraries: libxxx.so: cannot open shared object file: No such file or directory
This is expected.
The same happens when running a program compiled with Cygwin on Windows, either using 'gcc' or 'x86_64-w64-mingw32-gcc', but only if I run the program within the Cygwin Terminal.
If I run the program within the Windows Command Prompt, I do not get any error messages (the program simply does not do anything).
Below are the instructions to reproduce the issue.
File 'foo.h':
#ifndef foo_h__
#define foo_h__
extern void foo(void);
#endif // foo_h__
File 'foo.c':
#include <stdio.h>
void foo(void)
{
puts("Hello, I'm a shared library");
}
File 'main.c':
#include <stdio.h>
#include "foo.h"
int main(void)
{
puts("This is a shared library test...");
foo();
return 0;
}
Build object file 'foo.o':
x86_64-w64-mingw32-gcc -c foo.c
Build shared library 'libfoo.dll':
x86_64-w64-mingw32-gcc -shared -o libfoo.dll foo.o
Build executable 'foo.exe':
x86_64-w64-mingw32-gcc -o foo.exe main.c libfoo.dll
Rename shared library 'libfoo.dll':
mv libfoo.dll liberror.dll
If you run 'foo.exe' within the Cygwin Terminal you get the error message, if you run it within the Windows Command Prompt you do not get any messages printed out.
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple