This is the mail archive of the cygwin-talk@cygwin.com mailing list for the cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Compiling a windows.exe against cygwin1.dll ?


On Mon, 25 Oct 2004, Wim Van Oudenhove wrote:

> Dave Korn <dk <at> artimi.com> writes:
> > > -----Original Message-----
> > > From: cygwin-talk-owner On Behalf Of Wim Van Oudenhove
> > > Sent: 22 October 2004 17:06
> >
> > > I've made an executable windows program which some people
> > > want to run under cygwin (myself included).
> > >
> > > The problem is that the first parameter to the program is the
> > > name of a file,
> > > which is expected by windows to be something like c:\dir\file.txt
> > >
> > > Two problems:
> > >
> > > - it doesn't take /cygdrive/c/dir/file.txt
> > > - it doesn't take a symbolic link generated by cygwin's ln -s command.
> > >
> > > Is there something I can 'borrow' from cygwin1.dll or some
> > > other dll to make my
> > > program support these two cases ?
> > > (The program is a command line tool written using visual C++)
> >
> >   Well, yeah: what you're really saying there is that you want a
> > cygwin app rather than a 'doze one.  Rewrite it using the standard
> > ANSI C stdio functions (f)open, (f)close, (f)read, (f)write (assuming
> > it isn't already using them), and use cygwin gcc to compile it instead
> > of msvc, and you'll get all that functionality for free.
>
> I would have done that a long time ago if I knew how to use COM under
> GCC.

Just like you'd use it under MSVC: call the functions.  Nothing prevents a
Cygwin program from calling pure Windows functions for the functionality
not present in Cygwin -- that's what the w32api effort is for.  Just don't
reinvent the wheel and reimplement functionality that's already present in
Cygwin.  Many Cygwin programs do that, e.g., XWin and rxvt.

> The key purpose of this program is that it talks to the windows
> sceduler, so it uses:
>
> #include <mstask.h>
> CoInitialize()
> CoCreateInstance(CLSID_CTaskScheduler,...)
> CoTaskMemFree()
>
> And a whole bunch of functions related to them.
>
> Not exactly the most common functions in GCC afaik.

See how the perl libwin32 does it.  Or you could just use cron... ;-)

> It also uses some of the AFX CList, CMap, and CArray templates. I'm sure
> someone has written equivalents for them in ansi C somewhere, but all
> this sounds like too much work for the same purpose.

Those are probably more of a problem for gcc than the Win32 functions.  To
be pedantic, you want their equivalents in ANSI C++, not ANSI C.  AFAIK,
the Cygwin version of gcc comes with an STL implementation -- will that
do?

> The function it performs is available by default on a unix workstation,
> so I doubt that I'll ever need it for another operating system than
> windoze.

Which function is that?  Perhaps it's also available on Cygwin already?
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Happiness lies in being privileged to work hard for long hours in doing
whatever you think is worth doing."  -- Dr. Jubal Harshaw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]