Using main() from a shared library in Cygwin 1.7

Kurt Franke Kurt-Franke@web.de
Fri May 14 13:02:00 GMT 2010


Ferenc Kovacs <derefer <at> gmail.com> writes:

...
> I have an application, which links with a shared library (fairly common
> situation :)).  This shared library provides the main() function.  This
> approach works well on Linux/Solaris machines, but on Cygwin 1.7
> I get the following link error:
...

Hi Ferenc,

some years ago I had a problem with main function in a library under VMS
The linker just didn't search for it in a library.

To force it to search a reference in a non-library part of source did help.

I just added the following code in the main source file:

extern int main();
static int (*force_linker_search_for_main_in_library)() = main;

maybe something similar will help you

regards

kf






--
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