Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 80608 invoked from network); 11 Feb 2004 09:28:39 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 11 Feb 2004 09:28:39 -0000 Received: (qmail 27243 invoked by uid 500); 11 Feb 2004 09:28:09 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 27066 invoked by uid 500); 11 Feb 2004 09:28:08 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 26874 invoked from network); 11 Feb 2004 09:28:05 -0000 X-Injected-Via-Gmane: http://gmane.org/ To: dev@apr.apache.org From: Vicent Subject: APR on Mingw Date: Wed, 11 Feb 2004 09:28:16 +0000 (UTC) Lines: 97 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: main.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 80.58.50.174 (Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8) Sender: news X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hello, I've been trying to use the Visual APR dll on MINGW, and finally managed to have success. Hoewever it requires a patch in apr.h to work, and I would like to submmit it to your approval: Steps to make MSVC apr.dll work on MINGW: 1) Change line 142 in "apr.h" from: #ifndef __attribute__ to: #if !defined(__attribute__) && !defined(__MINGW32__) This is of maximum importance, since we need to assure that the attribute is not redefined. If we don't do this, function in APR will not be correctly declared as _declspec(dllimport) ___stdcall, and we will not be able to link. That's why I suggest this being incorporated into APR, since it doesn't have any side effect. 2) Generate an exports def from libapr.dll: pexports libapr.dll > libapr.def 3) Seperate the stdcall functions from the cdecl funtions in two defs. This is necessary since we need to build the libraries passing different parameters to dlltool. Basicaally, we cut&paste the end of the libapr.def in libapr-c.def, and then add the headers. so libapr-c.def would be LIBRARY libapr.dll EXPORTS apr_app_init_complete DATA apr_day_snames DATA apr_dbg_log apr_file_printf apr_month_snames DATA apr_os_level DATA apr_pool_cleanup_null apr_psprintf apr_pstrcat apr_snprintf apr_table_do apr_terminate We will name libapr-s.def the file resulting from cutting the above lines from libapr.def. 4) We create 2 import libs from the above defs: dlltool -U --input-def libapr-s.def -l libapr-s.a dlltool --input-def libapr-c.def -l libapr-c.a Note that the -U option is not passed in the second command. This is because apr_terminate is declared as a "cdecl" and thus doesn't have an underscore in the dll. 5) We can now link our program to libapr-s.a and libapr-c.a, and it shoud work. However if it is possible to generate a unique lib file for comodity. 6) We are going to merge the two ".a" in to a uniqui lib: copy libapr-?.a c:"tmp" cd "tmp mkdir libapr-s mkdir libapr-c mkdir libapr ar x libapr-s.a mv *.o libapr-s ar x libapr-c.a mv *.o libapr-c 7) Now enter libapr-c and rename all the .o files so that they don't clash with the files in libapr-s. I suggest the following: rename dh.o and dt.o to dhc.o and dtc.o. The rename all the ds000??.o files so that they correlate with the ending ds files from libapr-s: that is ds00001.o from libapr-c.a will become ds00392.o, ds00002.o --> ds00393.o, etc. 8)Now copy all the resulting .o files from libapr-s and libapr-c to libapr cd "tmp copy libapr-c"*.o libapr copy libapr-s"*.o libapr You should not need to replace any file. If you are asked, then you have to rename the file wich wants to be overwritten (step 7). 9) Generate libapr.a cd "tmp"libapr ar q libapr.a *.o ranlib libapr.a 10) That's it! Link your program to libapr.a and it should work.