Subject: Linking agains dll (was Re: Where to find gettimeofday(), local)
From: [email-masked] (Roland Geier)

19 Jun 1997 08:16:42 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Original-To: [email-masked]
X-Face: 
	 %JjDwL,CM#gbv*uICrNLdM9yk_LRxMh3DV'.fQ>iw'N;7([Jq}2|J#5o".kzM&>7tW`8T^Z
	 buvRLp?jvQ+sbD3BND%=&D: lT%vT4p7cGcGRP5JO+F'^
X-Mailer: ELM [version 2.4ME+ PL31 (25)]
Original-Sender: [email-masked]

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      [email-masked]	
D-94032 Passau                  http://www.uni-passau.de/~geier/

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".