Mail Archives: cygwin/2011/09/15/09:17:54
X-Recipient: | archive-cygwin AT delorie DOT com
|
X-SWARE-Spam-Status: | No, hits=-1.4 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_QL,T_TO_NO_BRKTS_FREEMAIL
|
X-Spam-Check-By: | sourceware.org
|
To: | cygwin AT cygwin DOT com
|
From: | Ted Byers <r DOT ted DOT byers AT gmail DOT com>
|
Subject: | Re: How do I run a program compiled in cygwin from a program that is running in a Windows CMD shell?
|
Date: | Thu, 15 Sep 2011 13:17:04 +0000 (UTC)
|
Lines: | 69
|
Message-ID: | <loom.20110915T150817-936@post.gmane.org>
|
References: | <loom DOT 20110915T060405-768 AT post DOT gmane DOT org>
|
Mime-Version: | 1.0
|
User-Agent: | Loom/3.14 (http://gmane.org/)
|
X-IsSubscribed: | yes
|
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm
|
List-Id: | <cygwin.cygwin.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
|
Thanks Marco and Andrew
I have actually been using Perl's back ticks and system (and not so much exec)
for years, using Activestate perl, but this is the first time I tried to use
them to run a program compiled using gcc within cygwin when I am running a
perl program from Windows CMD console.
Here is a little perl script that invokes a program (qlt is a C++ program I
wrote, and which I can compile using either MSVC++ or gcc):
use strict;
my $op = `./qlt.exe 6 2 2011 -1 10 12 2011 50 47 0.00 0.05 0.20`;
print "$op\n";
If I compile qlt.exe using MSVC++, then it runs fine and produces the
following output:
Compilation started at Thu Sep 15 08:38:28
C:/Perl64/bin\perl.exe -w c:/cygwin/home/Ted/Work/test.cygwin.perl.pl
Valuation date = February 6th, 2011
Option type = Put
Maturity = December 10th, 2011
Underlying price = 50
Strike = 47
Risk-free int. rate = 5.00 %
Dividend yield = 0.00 %
Volatility = 20.00 %
Option price : 1.5465
Delta : -0.25516
Elasticity : -8.2498
Gamma : 0.035025
Vega : 0.1473
Theta : -0.0028384
Rho : -0.12032
Implied vol. : 20.00 %
Compilation finished at Thu Sep 15 08:38:29
However, when I compile the program using gcc within cygwin (and run it the
same way - Activestate perl from a Windows' CMD console, no output is
produced, and if I try to run qlt from Windows' CMD, it complains about a
missing DLL and dies..
So, I found a fix in terms of adding cygwin/bin to the path. That lets me
run the programs I compile using gcc within cygwin's bash shell in the same
way I run programs I compile using MSVC++. The downside is that I was
reluctant to make the cygwin programs themselves visible within Windows' CMD
shell as I was concerned about the possibility that doing so might break some
other Windows applications I use.
NB: this isn't a significant problem for this particular program (after all, I
have both MSVC++ and gcc/cygwin), but I have a colleague that is sending me
programs he developed on Ubuntu, and it would be a royal pain in the ass to
refactor those in order to build them using MSVC++. But the framework I
developed to invoke all these programs (using Activestate perl CGI programs
with Apache's httpd server, are not set up to run in cygwin (that, too, would
be a royal pain to set up to run within cygwin, especially getting all the
packages I use added alongside cygwin's perl).
Thanks again
Ted
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
- Raw text -