delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/03/27/15:43:03

X-Spam-Check-By: sourceware.org
Date: Tue, 27 Mar 2007 16:42:40 -0400 (EDT)
From: Igor Peshansky <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Antti Karanta <antti DOT karanta AT napa DOT fi>
cc: cygwin AT cygwin DOT com
Subject: Re: Loading cygwin1.dll from a windows app
In-Reply-To: <op.tpt1fqg2lo37ie@nw17.napa.fi>
Message-ID: <Pine.GSO.4.63.0703271638500.17509@access1.cims.nyu.edu>
References: <op DOT tpt1fqg2lo37ie AT nw17 DOT napa DOT fi>
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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

On Tue, 27 Mar 2007, Antti Karanta wrote:

> On Tue, 27 Mar 2007 01:00:42 +0300, Long, Phillip GOSS <Phillip DOT Long AT XXXXXXXXXXXXXXXXX DOT com> wrote:

<http://cygwin.com/acronyms/#PCYMTNQREAIYR>.  Thanks.

> > Antti Karanta wrote:
> > >  I am trying to load the cygwin1.dll from a windows c app
> >
> > Why?
>
>  To make the program behave correctly when used in cygwin bash shell.
> Or, more to the point, to make it understand paths given in the cygwin
> format.
>
> > >  I am trying to load cygwin1.dll to invoke the cygwin path conver-
> > > sion functions (to make my program easier to use from cygwin shell).
> > > I do this to convert the command line params denoting paths or files
> > > to windows format that the java virtual machine I am launching
> > > expects.  The jvm is also the reason why I can't compile my app as
> > > cygwin app - the java jni (java native interface) headers contain
> > > windows specific stuff that makes gcc fail, unless -mno-cygwin is
> > > used. BTW, now that Java
> >
> > Basically, I am a lazy programmer, taking the path of least resis-
> > tance.  If U're running this from bash (what most folks mean by 'the
> > Cygwin shell'), use command replacement and cygpath, and U don't have
> > to mess around with a DLL:
> > ~/> groovy $(cygpath -w /path/to/file/in/question/y.xml)
>
>  The problem is that groovy is a scripting language, and the program I'm
> working on is the launcher. It would be highly inconvenient for the user to
> have to invoke his scripts that way. Imagine you had to do:
>
> perl $(cygpath -w /path/to/file/in/question/y.pl)
> ruby $(cygpath -w /path/to/file/in/question/y.rb)
>
>  Also, since groovy is java based, the user often wants to input a classpath,
> and when in cygwin, he would propably want to give that in cygwin format.
>
> > Cygpath with the -w qualifier will convert Cygwin paths to Windows
> > paths, and U can avoid all the DLL messiness.
>
>  I know about cygpath tool and consider invoking it via the system()
> function as the last resort (if I can't make this work otherwise). It
> just feels clumsy having to launch extenal processes for simple path
> conversion.
>
> > This all happens at launch, correct?
>
>  Yes.
>
> > Launching another process, although it takes time,
> > is most easliy hidden from the end user at process launch; it's when
> > U can afford the delay most.  It's at least worth a try.
>
>  That's what I'll have to do if I can't make the dll loading behave. But
> I'm not giving up just yet.

You might want to take a look at the Java wrapper scripts[*], which do
most of what you want.  Another thing to note is that, given files foo and
foo.exe, Cygwin will first execute "foo", and Windows will only find
"foo.exe", so you could provide both an executable launcher and a script,
where the script is Cygwin-specific.
	Igor
[*] <http://cygwin.com/cgi-bin/cvsweb.cgi/wrappers/java/?cvsroot=cygwin-apps>
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Freedom is just another word for "nothing left to lose"...  -- Janis Joplin

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