This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Linking agains dll (was Re: Where to find gettimeofday(), local)


Hi!

> also I think you need to surround gettimeofday() and localtime() with
>
> extern "C" {
> struct tm *localtime(time_t *timer);
> int gettimeofday(struct timeval*, struct timezone*);
> }
>
> but that I'm not sure of, see how it works.

ooops... it works!!! 

>>
>>  -970404/../../../../i386-cygwin32/lib/libcygwin.a(libcmain.o)(.text+0x1e):
>>libcmain.cc: undefined reference to `WinMain@16'
>
> this you can ignore, it won't stop the link, unless you don't have a
>
> int main()( return 0;}
>
> in your fixup.c

Well, it *does* stop the link and no output is produced (NT4.0,
b18). There's no 'WinMain' or 'main' defined or referenced in any of
my files. Whereas if 'fixup.c' contains

            int main() {return 0;}

the dll is linked without any complaints, but an application
containing 'main' itself won't get linked against the dll as 'main' is
multiply defined :-( 

For example the following mini-test-driver won't work:

------------------------ snip tst.cc ------------------------

#include <iostream.h>
#include <Date.h>


int main () {
  cout << "This is main!" << endl;

  Date d( "16.5.1997" );
  
  cout << "Date created on " << d.GetDateStr() << endl ;
  return 1;
}

------------------------ snip tst.cc ------------------------

I'm compiling with:

> g++ -c tst.cc
> g++ -o tst tst.o DateTime.a

This works, but 'tst.exe' dies immediately after startup.

I admit I don't have the slightest idea what's going on there,
especially I did not yet get the meaning of the fixup-stuff :-(

Bye and once again thx in advance,

--- Roland.

---
Roland Geier                    Phone: ++49 (8505) 92181          
Universitaet Passau, GER 	Fax:   ++49 (8505) 922311
Lehrstuhl Prof. Dr. Donner      geier@forwiss.uni-passau.de	
D-94032 Passau                  http://www.uni-passau.de/~geier/







-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]