delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/11/02/14:20:50

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
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: <3FA5590F.6060308@santafe.edu>
Date: Sun, 02 Nov 2003 12:20:47 -0700
From: "Marcus G. Daniels" <mgd AT santafe DOT edu>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6a) Gecko/20031030
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: cygwin AT cygwin DOT com, java AT gcc DOT gnu DOT org
Subject: gcc 3.3.1-3, loading .la files from gcj-compiled apps
X-Filter-Version: 1.14 (kakapo)

Would it be possible to add a -D_WIN32 to the libjava/libltdl Makefile 
for Cygwin?  Then the LoadLibrary support will get compiled-in, and 
dynamic libraries can be loaded into GCJ apps.  If this is done, then a 
__CYGWIN__ conditional is needed in ltdl.c in order to first normalize 
the path for Windows, e.g. here's how I hacked it in my copy (not 
intended as a patch, just for illustration).   Also, I found I had to 
duplicate the stack copy of `buf' in java::lang::Runtime:_load in order 
to avoid it getting wiped out from the the exception getting caught.  
Please see the second illustrative patch.  With these two changes, I can 
use LoadLibrary in GCJ-compiled apps with libtool dynamic libraries in 
the same way that Sun JDK can load ordinary DLLs.

*** ltdl.c-orig    Sun Nov  2 11:12:58 2003
--- ltdl.c    Sun Nov  2 11:13:23 2003
***************
*** 479,486 ****
          strcpy(searchname, filename);
          strcat(searchname, ".");
      }
!
!     module = LoadLibrary(searchname);
      lt_dlfree(searchname);
     
      /* libltdl expects this function to fail if it is unable
--- 479,490 ----
          strcpy(searchname, filename);
          strcat(searchname, ".");
      }
!         {
!            char buf[1024];
!           
!            cygwin_conv_to_win32_path (searchname, buf);
!        module = LoadLibrary(buf);
!         }
      lt_dlfree(searchname);
     
      /* libltdl expects this function to fail if it is unable


*** natRuntime.cc-orig    Sun Nov  2 08:58:56 2003
--- natRuntime.cc    Sun Nov  2 11:59:29 2003
***************
*** 174,180 ****
    jsize total = JvGetStringUTFRegion (path, 0, path->length(), 
&buf[offset]);
    buf[offset + total] = '\0';
 
!   char *lib_name = buf;
 
    if (do_search)
      {
--- 174,180 ----
    jsize total = JvGetStringUTFRegion (path, 0, path->length(), 
&buf[offset]);
    buf[offset + total] = '\0';
 
!   char *lib_name = strdup (buf);
 
    if (do_search)
      {


--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019