Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <42C4939D.DED5398E@dessent.net> Date: Thu, 30 Jun 2005 17:51:41 -0700 From: Brian Dessent MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Dynamically load a shared lib created using gcc/Cygwin References: <200507010026 DOT j610Qhwa026567 AT citheronia DOT ucdavis DOT edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Report: -5.9/5.0 ---- Start SpamAssassin results * -3.3 ALL_TRUSTED Did not pass through any untrusted hosts * -2.6 BAYES_00 BODY: Bayesian spam probability is 0 to 1% * [score: 0.0000] * 0.0 AWL AWL: From: address is in the auto white-list ---- End SpamAssassin results X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com Yu-Cheng Chou wrote: > mylib.dll was created using gcc/cygwin based on some libraries that were > also built using gcc/cygwin and CANNOT be re-built by other compilers. > I have to, and need only to load mylib.dll at run-time by function > LoadLibrary("mylib.dll") > in an applicaiton that was built by Visual C++ or .NET. > When I ran this application in Windows XP, it hung at LoadLibrary > ("mylib.dll"). Please stop sending me personal email. This is a public mailing list, address all replies to the list. I don't see what the different compilers have to do with anything. You would be facing the same situation if you tried to load cygwin1.dll from a mingw program without properly initializing it, and in that case everything would be built from gcc. The only reason you don't have to worry about this for Cygwin .exes is that the initialization code is done for you in the CRT startup code. I don't know what to tell you. The Cygwin DLL has its own special requirements that have to be met. If you don't load it properly your application will not work. If you can't do that you can't use the DLL. You might be able to work around this by making a stub DLL with the same interface as mylib.dll, that would load and initialize cygwin1.dll and then load the real mylib.dll, and pass through any function calls to mylib.dll. But doing that would be a whole lot harder than just having the program that is doing LoadLibrary("mylib.dll") first load the Cygwin DLL. And since all these programs must be open source (or else you're violating the Cygwin license agreement), I don't see why you can't just do that. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/