public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* gcc 3.3.1-3, loading .la files from gcj-compiled apps
@ 2003-11-02 19:20 Marcus G. Daniels
  2003-11-02 19:44 ` Christopher Faylor
  2003-11-07 20:40 ` gcc 3.3.1-3, loading .la files from gcj-compiled apps Tom Tromey
  0 siblings, 2 replies; 15+ messages in thread
From: Marcus G. Daniels @ 2003-11-02 19:20 UTC (permalink / raw)
  To: cygwin, java

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/

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

end of thread, other threads:[~2003-11-08 21:19 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-02 19:20 gcc 3.3.1-3, loading .la files from gcj-compiled apps Marcus G. Daniels
2003-11-02 19:44 ` Christopher Faylor
2003-11-02 20:16   ` libltdl + dlopen/LoadLibrary [Was: Re: gcc 3.3.1-3, loading .la files from gcj-compiled apps] Charles Wilson
2003-11-02 20:21     ` Christopher Faylor
2003-11-07 20:40 ` gcc 3.3.1-3, loading .la files from gcj-compiled apps Tom Tromey
2003-11-07 20:50   ` Christopher Faylor
2003-11-07 20:54   ` Robert Collins
2003-11-07 21:40   ` Marcus G. Daniels
2003-11-08  1:09     ` Charles Wilson
2003-11-08  1:20       ` Robert Collins
2003-11-08  1:30         ` Charles Wilson
2003-11-08  1:35           ` Robert Collins
2003-11-08  4:14           ` Marcus G. Daniels
2003-11-08  9:24           ` Tom Tromey
2003-11-08 21:19             ` Charles Wilson

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).