public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* JNI functions under g++
@ 1998-10-23 21:27 JAMES DOYLE
  1998-10-26 23:49 ` Mumit Khan
  1998-10-28 22:22 ` Mumit Khan
  0 siblings, 2 replies; 7+ messages in thread
From: JAMES DOYLE @ 1998-10-23 21:27 UTC (permalink / raw)
  To: Gnu Win32 Mailing List

Hi,
	I've been using Gnu tools for years, but only 
recently needed to use them under Win32.  The reason I wanted
to try using the Win32 port is that I'm having mystifying problems
under Microsoft Visual C++.  I've been able to use VC++ in the past
to do JNI functions where I use malloc/free, but recently I've
needed to access C++ libraries that use new/delete, and under VC++
this is causing me problems.  Since things run fine on Solaris
with g++, I figured I'd try g++ on Windows.

	But, as Kiyoko Aoki and Andrew Mickish have noted
(re: B19 dll with JNI causing Dr. Watson, October 19), doing
C++ memory allocations doesn't work under GnuWin32 either.  
My DLL fails the first time it tries to call new().  I just thought
I'd let Kiyoko and Andrew (and other JNI people out there) know
there's another data point indicating trouble with JNI and
memory allocation.  Also, I thought you'd be interested to know
that MSVC++ has trouble with JNI and memory allocation, too.
I've posted to comp.lang.java.programmer asking if JNI
programmers in general have been able to work with C++ allocation
on Windows.  

Jim Doyle
jdoyle@sarnoff.com
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

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

* Re: JNI functions under g++
  1998-10-23 21:27 JNI functions under g++ JAMES DOYLE
@ 1998-10-26 23:49 ` Mumit Khan
  1998-10-28 22:22 ` Mumit Khan
  1 sibling, 0 replies; 7+ messages in thread
From: Mumit Khan @ 1998-10-26 23:49 UTC (permalink / raw)
  To: JAMES DOYLE; +Cc: Gnu Win32 Mailing List

On Fri, 23 Oct 1998, JAMES DOYLE wrote:

> 	But, as Kiyoko Aoki and Andrew Mickish have noted
> (re: B19 dll with JNI causing Dr. Watson, October 19), doing
> C++ memory allocations doesn't work under GnuWin32 either.  
> My DLL fails the first time it tries to call new().  I just thought
> I'd let Kiyoko and Andrew (and other JNI people out there) know
> there's another data point indicating trouble with JNI and
> memory allocation.  Also, I thought you'd be interested to know
> that MSVC++ has trouble with JNI and memory allocation, too.
> I've posted to comp.lang.java.programmer asking if JNI
> programmers in general have been able to work with C++ allocation
> on Windows.  

Turns out that the problem with cygwin dll when loaded from MSVC 
app is a different one -- cygwin DLL is not just not initialized 
properly and pretty much everything is liable to crash. Of course,
there may be more issues with C++, but we need to track this basic
problem down first.

Hopefully we'll track it down soon and fix. I do recommend not holding
your breath however ;-)

Good news is that mingw works like a charm.

I just released a new version of dllhelpers that should allow to build
JNI dlls using a single command (cf: dllwrap). I'll announce an example
JNI (I'm borrowing one from Andrew Mickish), complete with Makefile, 
sometime in the next few days.

Now, it's as simple as:
  
  $ gcc -c -I<jdk_root>/include [ ... ] HelloWorldImp.c
  $ dllwrap -o HelloWorld.dll --add-stdcall-suffix HelloWorldImp.o
  $ java [...]

Regards,
Mumit


-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

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

* Re: JNI functions under g++
  1998-10-23 21:27 JNI functions under g++ JAMES DOYLE
  1998-10-26 23:49 ` Mumit Khan
@ 1998-10-28 22:22 ` Mumit Khan
  1998-10-29  7:11   ` JAMES DOYLE
  1998-10-29 18:12   ` Windows sdr
  1 sibling, 2 replies; 7+ messages in thread
From: Mumit Khan @ 1998-10-28 22:22 UTC (permalink / raw)
  To: JAMES DOYLE; +Cc: Gnu Win32 Mailing List

On Fri, 23 Oct 1998, JAMES DOYLE wrote:

> Hi,
> 	I've been using Gnu tools for years, but only 
> recently needed to use them under Win32.  The reason I wanted
> to try using the Win32 port is that I'm having mystifying problems
> under Microsoft Visual C++.  I've been able to use VC++ in the past
> to do JNI functions where I use malloc/free, but recently I've
> needed to access C++ libraries that use new/delete, and under VC++
> this is causing me problems.  Since things run fine on Solaris
> with g++, I figured I'd try g++ on Windows.

Fyi, with the latest changes I've submitted to cygwin, it's now possible
to build both C and C++ JNI DLLs with cygwin GCC. I only tried the most
trivial JNI DLLs, so let's see what more bugs are hiding. The test cases
did include memory allocation (both malloc and new families) and standard
I/O (both printf and iostreams).

I don't know if the changes will be accepted however (that depends on
the quality of the patch, and Geoffrey will have to decide if it's
ok).

Regards,
Mumit


-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

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

* Re: JNI functions under g++
  1998-10-28 22:22 ` Mumit Khan
@ 1998-10-29  7:11   ` JAMES DOYLE
  1998-10-29  8:16     ` Mumit Khan
  1998-10-29 18:12   ` Windows sdr
  1 sibling, 1 reply; 7+ messages in thread
From: JAMES DOYLE @ 1998-10-29  7:11 UTC (permalink / raw)
  To: Mumit Khan; +Cc: Gnu Win32 Mailing List

Sounds great!  I thought that you had said there was a large
problem in invoking cygwin-linked DLLs from MSVC-linked apps,
such as Java.  Did you get around that problem?

BTW, I found out that my problem with MSVC was that one DLL was deleting
memory that was newed in a different DLL, which apparently does not
work at all.  Do you happen to know whether this is normal
shared library behavior?  It doesn't happen with shared objects
on Solaris, so I don't know if it's a Windows problem, or just an
MSVC problem.  Would it happen with cygwin DLLs, do you think?

Regards,
Jim

Mumit Khan wrote:
> 
> On Fri, 23 Oct 1998, JAMES DOYLE wrote:
> 
> > Hi,
> >       I've been using Gnu tools for years, but only
> > recently needed to use them under Win32.  The reason I wanted
> > to try using the Win32 port is that I'm having mystifying problems
> > under Microsoft Visual C++.  I've been able to use VC++ in the past
> > to do JNI functions where I use malloc/free, but recently I've
> > needed to access C++ libraries that use new/delete, and under VC++
> > this is causing me problems.  Since things run fine on Solaris
> > with g++, I figured I'd try g++ on Windows.
> 
> Fyi, with the latest changes I've submitted to cygwin, it's now possible
> to build both C and C++ JNI DLLs with cygwin GCC. I only tried the most
> trivial JNI DLLs, so let's see what more bugs are hiding. The test cases
> did include memory allocation (both malloc and new families) and standard
> I/O (both printf and iostreams).
> 
> I don't know if the changes will be accepted however (that depends on
> the quality of the patch, and Geoffrey will have to decide if it's
> ok).
> 
> Regards,
> Mumit
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

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

* Re: JNI functions under g++
  1998-10-29  7:11   ` JAMES DOYLE
@ 1998-10-29  8:16     ` Mumit Khan
  0 siblings, 0 replies; 7+ messages in thread
From: Mumit Khan @ 1998-10-29  8:16 UTC (permalink / raw)
  To: JAMES DOYLE; +Cc: Gnu Win32 Mailing List

"JAMES DOYLE" <jdoyle@sarnoff.com> writes:
> Sounds great!  I thought that you had said there was a large
> problem in invoking cygwin-linked DLLs from MSVC-linked apps,
> such as Java.  Did you get around that problem?

I've submitted a patch for this. Unless there is something really
wrong with the implementation, and/or it's a little too late 
for Geoffrey to include it, you can see it in upcoming b20.

> BTW, I found out that my problem with MSVC was that one DLL was deleting
> memory that was newed in a different DLL, which apparently does not
> work at all.  Do you happen to know whether this is normal
> shared library behavior?  It doesn't happen with shared objects
> on Solaris, so I don't know if it's a Windows problem, or just an
> MSVC problem.  Would it happen with cygwin DLLs, do you think?

Boo (I have something much worse in my book, but this is a gentle
public forum after all ;-) the people who designed the abomination
knows as "Windows 32 Dynamic Link Libraries". What you're seeing
is typical of when the runtimes for your DLL and Java are not exactly 
the same. Java uses MSVCRT.DLL, whereas VC++ built apps can be using 
quite a few different DLLs, and the heaps may not be the same.

You might consider defining new/delete for each class and see if that
helps a bit. You'll also need to wrap your other allocs and deallocs
in "object factory" style to guarantee that both actual alloc and 
dealloc happen in the same DLL.

Ah, the joys of ELF shared libraries.

Regards,
Mumit

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

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

* Windows
  1998-10-28 22:22 ` Mumit Khan
  1998-10-29  7:11   ` JAMES DOYLE
@ 1998-10-29 18:12   ` sdr
  1998-10-31  8:05     ` Windows Jan Tomasek
  1 sibling, 1 reply; 7+ messages in thread
From: sdr @ 1998-10-29 18:12 UTC (permalink / raw)
  To: gnu-win32

Hi, 
     I am running WIndows 95 on my system and am using beta 19 of
gnu-win32. When I try to run the program, it says out of environment
space. Sorry if this message has been posted more than one time, but have
been having mail domain errors. 

Thank you, 

Scott








-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

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

* Re: Windows
  1998-10-29 18:12   ` Windows sdr
@ 1998-10-31  8:05     ` Jan Tomasek
  0 siblings, 0 replies; 7+ messages in thread
From: Jan Tomasek @ 1998-10-31  8:05 UTC (permalink / raw)
  To: sdr, gnu-win32

Hi Scott,
read mail archives, this was discused many times before. For correct
run of B19 you will to install USP patch and about environment out
of space ... 
	SHELL=C:\COMMAND.COM /E:8192
This will set memory for e. to 8kB - put line into config.sys

Bye Jan

>      I am running WIndows 95 on my system and am using beta 19 of
> gnu-win32. When I try to run the program, it says out of environment
> space. Sorry if this message has been posted more than one time, but have
> been having mail domain errors.
> 
> Thank you,
-- 
                            Jan Tomasek,          student FEL-CVUT
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                            e-mail: xtomasej@fel.cvut.cz
                            www: http://mujweb.cz/web/tomasek
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~H~

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

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

end of thread, other threads:[~1998-10-31  8:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-10-23 21:27 JNI functions under g++ JAMES DOYLE
1998-10-26 23:49 ` Mumit Khan
1998-10-28 22:22 ` Mumit Khan
1998-10-29  7:11   ` JAMES DOYLE
1998-10-29  8:16     ` Mumit Khan
1998-10-29 18:12   ` Windows sdr
1998-10-31  8:05     ` Windows Jan Tomasek

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