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 X-Authentication-Warning: localhost.localdomain: ronald owned process doing -bs Date: Thu, 13 Mar 2003 13:32:22 +0100 (CET) From: Ronald Landheer-Cieslak X-X-Sender: ronald AT localhost DOT localdomain To: Nicholas Burton cc: cygwin AT cygwin DOT com Subject: Re: JNI multiple String problem In-Reply-To: <3E70607C.3D008283@hgu.mrc.ac.uk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Thu, 13 Mar 2003, Nicholas Burton wrote: > Yes I am lucky that you are working on JNI at the moment :^) > Thanks very much for your prompt and very helpful reply. You're quite welcome :) > I tried the gcc -mrtd flag and it did cure the problem. Good :) > I am not sure if I am running in rxvt. Does that happen automatically > when you execute cygwin.bat (ie bash --login -i) by double clicking the > cygwin icon? No. rxvt is one of the packages in the Cygwin net distribution, but if you want to use it, you'll have to install it (and edit the cygwin.bat a bit if you want it to launch rxvt for you :) > 'java StringEx' works for me in the cygwin terminal and under cmd.exe Good :) > I tried the same program under linux and it ran OK without using the > -mrtd flag, > using gcc 3.2 20020903 (Red Hat Linux 8.0 3.2-7). The -mrtd flag sets the calling convention to stdcall. In any case, you need to use the same calling convention as the Java VM uses (or rather: the one it expects you to use). It also has to find your functions in the DLL, so you need to use (roughly) the same naming convention. Using stdcall with gcc by adding the attribute does make the stack-manipulation OK, but mangles the name in a slightly different way than MSVC does (MSVC adds an underscore to the name, gcc doesn't). Using -mrtd changes the calling convention but not the name mangling, which allows the VM to both find the function (because there is no @... behind it and no underscore before it) and use it (because the return value is popped by the callee in stead of the caller). > Thanks for the info about releasing memory, --- (very strange). Actually, I should take that back - it does work. The memory is allocated and freed on/from the proper heap. (I just tried it out) I had some trouble with that earlier under MSVC, though.. (I'll figure that out when I get to it). ciao! rlc -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/