Re: perldoc for InlineX
by mwah (Hermit) on Oct 08, 2007 at 17:45 UTC
|
wapoor: I have installed Inline and InlineX on a Windows box.
What do you want to accomplish by using InlineX?
(I ask this because I "Inline" some stuff occasionally, but never
needed InlineX.)
Regards
mwa
| [reply] |
|
|
Excellent question. To make the long story short, all test code in our labs (including my perl code) is required to use some machine-generated C code at specified points -- no substitutions or translations are allowed. I will use anything that allows me to do so, and have looked at the options of Inline(X), XS, SWIG, and others. The tight schedule and high risk do not allow me to go in and learn everything the way I should (and would like to), so Inline sounded like the way to go. Alternative suggestions will be gratefully accepted.
| [reply] |
|
|
wapoor: all test code in our labs (including my perl code) is required to use some machine-generated C code at specified points -- no substitutions or translations are allowed.
OK, is this *C source* or a lib? If it's C source without much
dependencies, you may use plain Inline C, like
(this will reverse your nickname in C):
my $name = 'wapoor';
my $eman = reverse_by_c($name);
print "$name, $eman\n";
use Inline C => qq[
SV* reverse_by_c(SV *pname)
{
SV* retval;
STRLEN len, i;
char *eman, *name = SvPV(pname, len);
New(0, eman, len, char);
for(i=0; i<len; i++) eman[i] = name[len-i-1];
eman[len] = '\\0';
retval = newSVpv(eman, len);
Safefree(eman);
return retval;
}
];
This looks fairly simple and might be solvable for
a C programmer within a short time ... ;-)
You can include a lot of source this way, even
Win32 inline assembly will work fine.
(Or didn't I understand you correct and you
don't like plain Inline-C for some reason?)
Regards
mwa | [reply] [d/l] |
Re: perldoc for InlineX
by wapoor (Novice) on Oct 09, 2007 at 00:11 UTC
|
Two of us finally managed to locate the missing executable (cl.exe), so the compiler now works. But now comes the semi-infinite loop of searching through the new error messages to try to determine why some include files cannot be found. I know that I am a beginner with Inline and so forth (although not a perl beginner). But is installing a module and getting it running traditionally this difficult? Please forgive my frustration, but this is the end of the second day, with no apparent success. Thanks for all the help. | [reply] |
|
|
| [reply] |
|
|
As almut noted, there need to be some
environment variables set for the cl in VC++6 to work properly.
You may accomplish this by invoking (on a standard install, YMMV)
C:\Microsoft Visual Studio\VC98\Bin\vcvars32.bat
as noted in "vcvars invoked?" or by including
the PATH, INCLUDE, LIB, MSDevDir and MSVCDir "by hand".
If the environment variables are set properly, all should be fine.
(This is normally part of the MSVC install process, did you
deliberately not register the environment variables?)
For a first check, open a command prompt and
type "set" (and post the results here)
Regards
mwa
| [reply] |
Re: perldoc for InlineX
by wapoor (Novice) on Oct 08, 2007 at 18:48 UTC
|
MWA asked about the simple option of using Inline rather than InlineX. First, as I mentioned, no matter what I try, I cannot get any examples in perldoc Inline or the C-Cookbook to work: every attempt to fiddle with the syntax leads to new error messages. (Note: when I tried the examples mentioned above, I copied and pasted, so typing errors are not the problem.) Second, one of the occasional warning messages says that Inline is deprecated, and that I should switch to InlineX. I am open to any suggestions, and will gladly take this up offline to avoid cluttering this site if that would be more efficient. | [reply] |
|
|
wapor: I cannot get any examples in perldoc Inline or the C-Cookbook to work: every attempt to fiddle with the syntax leads to new error messages.
Uhmmm. I tried my example from below under WinXP, MSVC++6 (SP6) (VStudio 98),
Perl 5.8.8 (Activestate) and Inline V.0.44 (from Activestate ppm repository).
I didn't have the slightest problems. The only "nonstandard" thing I did
was to extract nmake 1.5 from M.S. and put it somwhere into the PATH.
What's your configuration anyway?
Regards
mwa
| [reply] |
|
|
Putting nmake in the path is a new suggestion. Thanks.
I'm not sure which configuration you meant (that is not a joke), so here goes with the information:
MS Windows XP, Version 2002, Service Pack 2.
Active State Perl 5.8.6 for Win32.
Visual C++ 6.0.
Here are the system responses when I tried the example you sent me (thanks, BTW):
D:\perl utility programs>perl wma.txt
*****************
This module is deprecated. Please install the latest version of InlineX::C2XS instead
*****************
Can't open D:\perl\config for output.
Permission denied
at -e line 0
BEGIN failed--compilation aborted.
Failed to autogenerate D:\perl utility programs\try InlineX\_Inline\config.
at wma.txt line 10
BEGIN failed--compilation aborted at wma.txt line 27.
D:\perl utility programs\try InlineX>perl wma.txt
*****************
This module is deprecated. Please install the latest version of InlineX::C2XS instead
*****************
Can't open D:\perl\config for output.
Permission denied
at -e line 0
BEGIN failed--compilation aborted.
Failed to autogenerate D:\perl utility programs\try InlineX\_Inline\config.
at wma.txt line 10
BEGIN failed--compilation aborted at wma.txt line 27.
--- Does that provide any clues? Note: I created the folder D:\perl\config today, and the permissions look correct.
| [reply] |
|
|
|
|
|
Re: perldoc for InlineX
by wapoor (Novice) on Oct 08, 2007 at 22:39 UTC
|
I upgraded to the latest version of ActiveState perl as you suggested. Then I reinstalled practically everything.
And here is the current response: C:\Temp\herehere>perl wma.txt
Microsoft (R) Program Maintenance Utility Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.
C:\Perl\bin\perl.exe C:\Perl\lib\ExtUtils\xsubpp -typemap C:\
+Perl\lib\ExtUtils\typemap wma_txt_8d90.xs > wma_txt_8d90.xsc && C:\P
+erl\bin\per
l.exe -MExtUtils::Command -e mv wma_txt_8d90.xsc wma_txt_8d90.c
cl -c -IC:/Temp/herehere -nologo -GF -W3 -MD -Zi -DNDEBUG -O
+1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DNO_HASH_SEED -DU
+SE_SITECUST
OMIZE -DPRIVLIB_LAST_IN_INC -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SY
+S -DUSE_PERLIO -DPERL_MSVCRT_READFIX -MD -Zi -DNDEBUG -O1 -DVERSIO
+N=\"0.00\"
-DXS_VERSION=\"0.00\" "-IC:\Perl\lib\CORE" wma_txt_8d90.c
'cl' is not recognized as an internal or external command,
operable program or batch file.
NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code
+ '0x1'
Stop.
A problem was encountered while attempting to compile and install your
+ Inline
C code. The command that failed was:
nmake > out.make 2>&1
The build directory was:
C:\Temp\herehere\_Inline\build\wma_txt_8d90
To debug the problem, cd to the build directory, and inspect the outpu
+t files.
at wma.txt line 9
BEGIN failed--compilation aborted at wma.txt line 26.
C:\Temp\herehere>
At least we now seem to be seeing something concrete, namely the complaint about "cl". But I do not know where the compiler is seeing "cl". Any more ideas? Would it be more productive for us to discuss this offline by e-mail? Thanks, tpp | [reply] [d/l] |
Re: perldoc for InlineX
by syphilis (Archbishop) on Oct 09, 2007 at 06:45 UTC
|
No documentation found for 'InlineX'
There is no 'InlineX' module (that I could find). There is InlineX::C2XS, InlineX::CPP2xs and InlineX::XS. All three come with documentation that is accessible via perldoc (once the the modules have been installed) -eg perldoc InlineX::C2XS.
Cheers, Rob | [reply] [d/l] [select] |
Re: perldoc for InlineX
by wapoor (Novice) on Oct 09, 2007 at 16:07 UTC
|
Thank you for your suggestions. Here are my responses:
1. Visual C++ seemed to be running fine: I could already build straightforward C and C++ code.
Nevertheless, I ran vcvars32.bat as almut suggested, and there were no complaints.
2. And here is the output from set, which was requested by mwa:
C:\Temp\herehere>set
a29_debugger_targets=\\swtech\tools\misc\examples\a29_debugger_targets
+\a29_debugger_targets.txt
ALLUSERSPROFILE=D:\Documents and Settings\All Users
APPDATA=D:\Documents and Settings\e347488\Application Data
ATICPLdir=VIDEO\R98363\Setup.exe /K
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=AZ75DT8VD0Y91
ComSpec=C:\WINDOWS\system32\cmd.exe
DEFLOGDIR=D:\Documents and Settings\All Users\Application Data\McAfee\
+DesktopProtection
drvdir=C:\DRV
eReviewsServer=\\Casanova\eReviews
FP_NO_HOST_CHECK=NO
HOMEDRIVE=D:
HOMEPATH=\Documents and Settings\e347488
HOMESHARE=\\DVTVS341\e347488
h_eng_com=c:\program files\common files\honeywell_eng
INCLUDE=C:\PROGRA~1\MICROS~3\VC98\ATL\INCLUDE;C:\PROGRA~1\MICROS~3\VC9
+8\INCLUDE;C:\PROGRA~1\MICROS~
3\VC98\MFC\INCLUDE;
KMP_DUPLICATE_LIB_OK=TRUE
LDMS_LOCAL_DIR=C:\Program Files\LANDesk\LDClient\Data
LIB=C:\PROGRA~1\MICROS~3\VC98\LIB;C:\PROGRA~1\MICROS~3\VC98\MFC\LIB;
LM_LICENSE_FILE=7177@tmpux134.allied.com;7177@flclmgr3.flclw.honeywell
+.com;17148@swapps;17159@swapp
s2;17188@swapps3
LOGONSERVER=\\AZ77DC401
MANU=Dell Inc.
MKL_SERIAL=YES
MODEL=GX620
MSDevDir=C:\PROGRA~1\MICROS~3\Common\msdev98
MSVCDir=C:\PROGRA~1\MICROS~3\VC98
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
Path=C:\PROGRA~1\MICROS~3\Common\msdev98\BIN;C:\PROGRA~1\MICROS~3\VC98
+\BIN;C:\PROGRA~1\MICROS~3\Com
mon\TOOLS\WINNT;C:\PROGRA~1\MICROS~3\Common\TOOLS;C
:\Perl\bin;c:\program files\common
files\honeywell_eng\dlls;c:\perl\bin\;C:\WINDOWS\system32;C:\WINDOWS;c
+:\serena\change~1\dimens~1\9.
1\prog;C:\WINDOW
S\system32\wbem;c:\program files\common files\adaptec shared\system;c:
+\program
files\teplugin;c:\program files\hummingbird\connectivity\8.00\accessor
+i
es\;C:\Program Files\MATLAB\R2007a\bin;C:\Program Files\MATLAB\R2007a\
+bin\win32;c:\program
files\matlab\r2006b\bin;c:\program files\matlab\r2006b\bin\
win32;c:\program files\matlab\r2006a\bin\win32;;C:\Program Files\Commo
+n
Files\System\MSMAPI\1033;C:\Program Files\Oracle\instantclient10_2;C:\
+Perl\lib
;C:\Program Files\Microsoft Visual Studio\VC98\Bin;C:\PROGRA~1\TEPlugi
+n;C:\Perl\bin;c:\program
files\common files\honeywell_eng\dlls;c:\perl\bin\;C:\W
INDOWS\system32;C:\WINDOWS;c:\serena\change~1\dimens~1\9.1\prog;C:\WIN
+DOWS\system32\wbem;c:\program
files\common files\adaptec shared\system;c:\progra
m files\teplugin;c:\program files\hummingbird\connectivity\8.00\access
+ories\;C:\Program
Files\MATLAB\R2007a\bin;C:\Program Files\MATLAB\R2007a\bin\win
32;c:\program files\matlab\r2006b\bin;c:\program files\matlab\r2006b\b
+in\win32;c:\program
files\matlab\r2006a\bin\win32;;C:\Program Files\Common Files
\System\MSMAPI\1033;C:\Program Files\Oracle\instantclient10_2;C:\Perl\
+lib;C:\Program
Files\Microsoft Visual Studio\VC98\Bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PERL5_INCLUDE=C:\Perl\lib\CORE
PERL5_LIB=C:\Perl\lib\CORE
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 15 Model 4 Stepping 9, GenuineIntel
PROCESSOR_LEVEL=15
PROCESSOR_REVISION=0409
ProgramFiles=C:\Program Files
PROMPT=$P$G
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=c:\temp
TMP=c:\temp
TNS_ADMIN=C:\Program Files\Oracle\instantclient10_2\NETWORK\ADMIN
TYPE=Optiplex
UDICONF=\\swtech\tools\misc\examples\a29_debugger_targets\a29_debugger
+_targets.txt
USERDNSDOMAIN=NAMERICA4.DS.HONEYWELL.COM
USERDOMAIN=NAMERICA4
USERNAME=e347488
USERPROFILE=D:\Documents and Settings\e347488
VSEDEFLOGDIR=D:\Documents and Settings\All Users\Application Data\McAf
+ee\DesktopProtection
windir=C:\WINDOWS
C:\Temp\herehere>
3. And finally, I was able to locate and install the Win32 versions of the modules Rob suggested.
Other than waiting for any suggestions based on the output from set, I will charge
ahead. Thanks again, tpp | [reply] [d/l] |