No error messages printed out within Windows Command Prompt when shared libraries are not found
Luca
lucatrv@hotmail.com
Tue Oct 17 21:41:00 GMT 2017
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
More information about the Cygwin
mailing list