libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: linking with fltk-1.1


From: Tim Van Holder
Subject: Re: linking with fltk-1.1
Date: 13 Feb 2002 08:32:57 +0100

On Wed, 2002-02-13 at 03:01, Ted Irons wrote:
> We are using cygwin (1.3.9) with fltk-1.1 on a
> Windows NT machine.
> 
> Our C++ package uses autoconf, automake, and
> libtool to maintain the build system.
> CXXFLAGS contains -DWIN32.
> LDFLAGS contains -no-undefined and -mwindows.
> configure.ac contains the AC_LIBTOOL_WIN32_DLL.
> However, when I run configure I'm using the --disable-shared flag.
> 
> The program has fltk, glut, and opengl calls.
> Fltk was built using its configure under cygwin
> (one of the flags that this sets is -DWIN32).   The fltk
> test programs build and run fine.
> 
> Since the program seg faults  (in an fltk call)
> when invoked,  I was wondering if there was
> some kind of disconnect between the fltk libraries
> and our libraries.  Something that I may have
> missed?   The program seems to link correctly
> (except for a missing _WinMainCRTStartup call,
> which it says it can't find and will default to
> some address that seems to correspond to _mainCRTStartup).
> 
> This program works under  Solaris, Linux, and IRIX.
> 
> Thanks in advance,
> - Ted

IIRC, Windows needs a WinMain entry point for GUI apps, and
a standard main() entry point for console apps.
It looks like you're building this app as a GUI one, but only
have a main() entry point.  Try adding '-mconsole' to LDFLAGS;
this should cause the app to be built as a console one.
Note that this has the unfortunate side-effect that your app
will open an empty console window if launched from Windows
Explorer instead of the command line.

An alternative would be to add a WinMain function; this has the
big drawback that WinMain gets the command line as one big string,
so you have to chop it up into pieces yourself.


int
#if !defined(WIN32)
main(int argc, char** argv)
#else
main_entry_point(int argc, char** argv)
#endif
{
...
}

#if defined(WIN32)
INT WINAPI
WinMain(check_your_win_api_ref_for_correct_signature)
{
int myargc = 0;
char** myargv = NULL;
  /* Get the executable name (for argv[0]) using the Win32 API */
  ...
  /* Chop up the command line into pieces, adding them to myargv */
  ...
  /* Chain to the regular entry point */
  return main_entry_point(myargc, myargv);
}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]