Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Date: Fri, 22 Sep 2000 09:37:15 -0400 From: Jason Tishler To: Cygwin Subject: Is __imp_reent_data Deprecated? (a.k.a Problem #3 Building Cygwin PostgreSQL) Message-ID: <20000922093715.C1458@DP> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="BkzApM6oPsfgDN/+" Content-Disposition: inline User-Agent: Mutt/1.2.4i Organization: Dot Hill Systems Corp. --BkzApM6oPsfgDN/+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline While building PostgreSQL 7.0.2 on a stock Cygwin 1.1.4, I had problems during the linking phase because of the attached file contributed by Mumit Khan. Specifically, I had an undefined reference to '__imp_reent_data' due to the following line: _impure_ptr = __imp_reent_data; Reading the comments, I can only assume that '__imp_reent_data' is a vestige of b19. If so, what is the appropriate analog for the Net release? BTW, searching the archives I found exactly the same problem as documented by: http://sources.redhat.com/ml/cygwin/2000-07/msg00629.html Unfortunately, there was no response to this post. Hopefully, I will be more fortunate. At least, I can try, try again... Thanks, Jason -- Jason Tishler Director, Software Engineering Phone: +1 (732) 264-8770 x235 Dot Hill Systems Corporation Fax: +1 (732) 264-8798 82 Bethany Road, Suite 7 Email: Jason DOT Tishler AT dothill DOT com Hazlet, NJ 07730 USA WWW: http://www.dothill.com --BkzApM6oPsfgDN/+ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="dllinit.c" /* dllinit.c -- Portable DLL initialization. Copyright (C) 1998 Free Software Foundation, Inc. Contributed by Mumit Khan (khan AT xraylith DOT wisc DOT 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 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 #undef WIN32_LEAN_AND_MEAN #include BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD reason, LPVOID reserved /* Not used. */ ); #ifdef __CYGWIN32__ #include 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 DllMain( HINSTANCE hInst /* Library instance handle. */ , DWORD reason /* Reason this function is being called. */ , LPVOID 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; } --BkzApM6oPsfgDN/+ Content-Type: text/plain; charset=us-ascii -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com --BkzApM6oPsfgDN/+--