public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* RE: undefined reference to _imp_reent_data ? (postgres 7.0RC5 compile)
@ 2000-05-07 15:09 Joost Kraaijeveld
  0 siblings, 0 replies; 2+ messages in thread
From: Joost Kraaijeveld @ 2000-05-07 15:09 UTC (permalink / raw)
  To: Cygwin@Sourceware. Cygnus. Com (E-mail)

I got Postgres compiled today. I had to change the following after
untarring:

1. I had to change YFLAGS in /src/template/cygwin32 to resemble my
installation.
2. In /src/backend/utils/elog.c and /src/backend/utils/exc.c I changed 

	extern int	sys_nerr;

	to

	#ifdef __CYGWIN__
	#  define sys_nerr _sys_nerr
	#else
	   extern int sys_nerr;
	#endif

3. I removed all code (commented it out) from the /src/utils/dllinit.c
but kept the file so I did not have to edit the makefile.

I ran all the regression tests and now I am studying the results. So it
works.

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
email: J.Kraaijeveld@Askesis.nl
web: www.askesis.nl 


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* undefined reference to _imp_reent_data ? (postgres 7.0RC5 compile)
@ 2000-05-07 12:39 Juhan Ernits
  0 siblings, 0 replies; 2+ messages in thread
From: Juhan Ernits @ 2000-05-07 12:39 UTC (permalink / raw)
  To: cygwin

Hello!

The trouble is the following. I am trying to compile Postgres 7.0RCx
under cygwin's latest net release (May 3 2000 or sth). There are a few
catches with types in dll call and  with _sys_nerr, but these are all
fixable using the mailing list archives. But this message beats me.
Where should I look for this __imp_reent_data? I cannot find this
declaration in cygwin's sources nor anywhere else. The code I'm in
trouble with is in dllinit.c contributed by Mumit Khan  in 1998 and is
copied here after the error output. 

I am quite new to cygwin, so please excuse stupid questions :-)

Thanks,

Juhan Ernits

 

ln -s ../../backend/lib/dllist.c .
gcc -I../../include -I../../backend   -O2 -I/usr/local/include -Wall
-Wmissing-p
rototypes -Wmissing-declarations -DFRONTEND   -c dllist.c -o dllist.o
gcc -I../../include -I../../backend   -O2 -I/usr/local/include -Wall
-Wmissing-p
rototypes -Wmissing-declarations -DFRONTEND   -c pqsignal.c -o
pqsignal.o
ln -s ../../backend/port/inet_aton.c .
gcc -I../../include -I../../backend   -O2 -I/usr/local/include -Wall
-Wmissing-p
rototypes -Wmissing-declarations -DFRONTEND   -c inet_aton.c -o
inet_aton.o
dlltool --export-all --output-def pq.def fe-auth.o fe-connect.o
fe-exec.o
fe-mis
c.o fe-print.o fe-lobj.o pqexpbuffer.o dllist.o pqsignal.o  inet_aton.o
dllwrap -o pq.dll --dllname pq.dll --def pq.def fe-auth.o fe-connect.o
fe-exec.o
 fe-misc.o fe-print.o fe-lobj.o pqexpbuffer.o dllist.o pqsignal.o
inet_aton.o .
./../utils/dllinit.o  -L/usr/local/lib -L/usr/local/pgsql/lib
-L../../backend -l
postgres -lcygipc -lcygwin -lcrypt -lkernel32 -lcrypt
../../utils/dllinit.o(.text+0x100):dllinit.c: undefined reference to
`__imp_reent_data'
collect2: ld returned 1 exit status
dllwrap: gcc exited with status 1
make[2]: *** [libpq.a] Error 1
make[2]: Leaving directory
`/export/installs/postgresql-7.0RC5/src/interfaces/libpq'
make[1]: *** [all] Error 2
make[1]: Leaving directory
`/export/installs/postgresql-7.0RC5/src/interfaces'
make: *** [all] Error 2


/* dllinit.c -- Portable DLL initialization.
   Copyright (C) 1998 Free Software Foundation, Inc.
   Contributed by Mumit Khan (khan@xraylith.wisc.edu).

   I've used DllMain as the DLL "main" since that's the most common
   usage. MSVC and Mingw32 both default to DllMain as the standard
   callback from the linker entry point. Cygwin32 b19+ uses essentially
   the same, albeit slightly differently implemented, scheme. Please
   see DECLARE_CYGWIN_DLL macro in <cygwin32/cygwin_dll.h> for more
   info on how Cygwin32 uses the callback function.

   The real entry point is typically always defined by the runtime
   library, and usually never overridden by (casual) user. What you can
   override however is the callback routine that the entry point calls,
   and this file provides such a callback function, DllMain.

   Mingw32: The default entry point for mingw32 is DllMainCRTStartup
   which is defined in libmingw32.a This in turn calls DllMain which is
   defined here. If not defined, there is a stub in libmingw32.a which
   does nothing.

   Cygwin32: The default entry point for cygwin32 b19 or newer is
   __cygwin32_dll_entry which is defined in libcygwin.a. This in turn
   calls the routine you supply to the DECLARE_CYGWIN_DLL (see below)
   and, for this example, I've chose DllMain to be consistent with all
   the other platforms.

   MSVC: MSVC runtime calls DllMain, just like Mingw32.

   Summary: If you need to do anything special in DllMain, just add it
   here. Otherwise, the default setup should be just fine for 99%+ of
   the time. I strongly suggest that you *not* change the entry point,
   but rather change DllMain as appropriate.

 */


#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#include <stdio.h>

/* this was the original code which gcc 2.95.2 did not accept:
BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD reason,
		LPVOID reserved /* Not used. */ );
*/

BOOL WINAPI DllMain(HANDLE hInst, DWORD reason,
		void *reserved /* Not used. */ );
 


#ifdef __CYGWIN32__

#include <cygwin/cygwin_dll.h>
DECLARE_CYGWIN_DLL(DllMain);
/* save hInstance from DllMain */
HINSTANCE	__hDllInstance_base;

#endif	 /* __CYGWIN32__ */

struct _reent *_impure_ptr;

extern struct _reent *__imp_reent_data;

/*
 *----------------------------------------------------------------------
 *
 * DllMain
 *
 *	This routine is called by the Mingw32, Cygwin32 or VC++ C run
 *	time library init code, or the Borland DllEntryPoint routine. It
 *	is responsible for initializing various dynamically loaded
 *	libraries.
 *
 * Results:
 *		TRUE on sucess, FALSE on failure.
 *
 * Side effects:
 *
 *----------------------------------------------------------------------
 */
/*BOOL		APIENTRY  /*the original code*/
DllMain(
		HINSTANCE hInst /* Library instance handle. */ ,
		DWORD reason /* Reason this function is being called. */ ,
		LPVOID reserved /* Not used. */ )
{
*/
BOOL		WINAPI
DllMain(
		HANDLE hInst /* Library instance handle. */ ,
		DWORD reason /* Reason this function is being called. */ ,
		void *reserved /* Not used. */ )
{

#ifdef __CYGWIN32__
	__hDllInstance_base = hInst;
#endif	 /* __CYGWIN32__ */

	_impure_ptr = __imp_reent_data;

	switch (reason)
	{
		case DLL_PROCESS_ATTACH:
			break;

		case DLL_PROCESS_DETACH:
			break;

		case DLL_THREAD_ATTACH:
			break;

		case DLL_THREAD_DETACH:
			break;
	}
	return TRUE;
}

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-05-07 15:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-07 15:09 undefined reference to _imp_reent_data ? (postgres 7.0RC5 compile) Joost Kraaijeveld
  -- strict thread matches above, loose matches on Subject: below --
2000-05-07 12:39 Juhan Ernits

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).