[haiku-development] Re: main() in shared libraries?

  • From: François Revol <revol@xxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Thu, 23 Apr 2015 19:50:28 +0200

On 23/04/2015 19:10, François Revol wrote:

On 23/04/2015 18:58, Adrien Destugues wrote:
This does not need a main function inthe library to work. AC_CHECK_LIB
generates something like this:

int main ()
{
main ();
return 0;
}


Oh right, here /lib/x86_64-linux-gnu/libc.so.6 doesn't have a main (but
does have an entry point set in the ELF header).

and checks that it compiles and links. In C, it should, since there IS a
main function in that file. However, in C++ it is not allowed to call
main and gcc will emit an error when set to strict standards:
http://lists.gnu.org/archive/html/autoconf/2006-09/msg00019.html

I don't know of a better solution, but at least the check for "main"
works for all C libraries.

Well, those two work with the symbols I chose.

Oh, I just checked with main again and the test seem to work, oh well.

François.


Other related posts: