DigitalKitty has asked for the wisdom of the Perl Monks concerning the following question:

Hi all.

I decided it was time to explore the Inline::C module so I copied 'n pasted this example from a web site this afternoon in an attempt to see how it worked. When I ran this code:

use Inline C; use warnings; greet('Ingy'); greet(42); __END__ __C__ void greet(char* name) { printf("Hello %s!\n", name); }

I received this error:

C:\perl>perl p1.pl File creation error File creation error File creation error Bad command or file name Bad command or file name Can't create Inline validation file C:/perl/_Inline/lib/auto/p1_pl_f75 +5/p1_pl_f7 55.inl at blib\lib\Inline.pm (autosplit into blib\lib\auto\Inline\writ +e_inl_file .al) line 849. INIT failed--call queue aborted.

Note: I couldn't 'use strict' because the author had included the line __C__ in the code. I removed it, used strict, ran the code again but the error was the same.

Any suggestions?
I have never used XS so if that is the missing step, feel free to show me ( with a small example perhaps? ) how I would do that.

Thanks in advance,

-Katie.

edited: Sun Jan 5 17:41:31 2003 by jeffa - added <readmore> tag

Replies are listed 'Best First'.
Re: Inline::C error.
by PodMaster (Abbot) on Jan 03, 2003 at 23:09 UTC
    Which version of Inline::C do you have? ( what does perl -mInline::C -e"die Inline::C->VERSION" report?)

    Do you have a compiler?

    Did you install Inline::C? (perl Makefile.PL...)

    Did all tests pass?

    Did you try reinstalling Inline::C?

    update: works fine for me

    C:\>perl -mInline::C -e"die Inline::C->VERSION" 0.43 at -e line 1. C:\>perl -V Summary of my perl5 (revision 5 version 6 subversion 1) configuration: Platform: osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef usethreads=undef use5005threads=undef useithreads=define usemultip +licity=define useperlio=undef d_sfio=undef uselargefiles=undef usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef Compiler: cc='cl', ccflags ='-nologo -O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE -DN +O_STRICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_S +Y S -DPERL_MSVCRT_READFIX', optimize='-O1 -MD -DNDEBUG', cppflags='-DWIN32' ccversion='', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=4 alignbytes=8, usemymalloc=n, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -release -libpath:"C:/ +Perl\lib\CORE" -machine:x86' libpth="C:\Program Files\Microsoft Visual Studio\VC98\mfc\lib" "C: +\Program Files\Microsoft Visual Studio\VC98\lib" "C:\Perl\lib\CORE" libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib + comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netap +i 32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib +odbccp32.lib msvcrt.lib perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool +.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib n +e tapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32. +lib odbccp32.lib msvcrt.lib libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl56.lib Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -release -l +ibpath:"C:/Perl\lib\CORE" -machine:x86' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_ITHREADS PERL_IMPLICIT_CONTEX +T PERL_IMPLICIT_SYS Locally applied patches: ActivePerl Build 633 Built under MSWin32 Compiled at Jun 17 2002 21:33:05 @INC: C:/Perl/lib C:/Perl/site/lib . C:\>perl use Inline C; use warnings; greet('Ingy'); greet(42); __END__ __C__ void greet(char* name) { printf("Hello %s!\n", name); } ^Z Hello Ingy! Hello 42! C:\> C:\>dir /od|tail 12/25/2002 11:02p <DIR> mysql 12/30/2002 09:43a <DIR> Program Files 01/01/2003 09:01a <DIR> wxWindows_2.3.4 01/01/2003 09:14a <DIR> WINNT 01/01/2003 09:51p 600 PUTTY.RND 01/03/2003 01:33a <DIR> TEMP 01/03/2003 02:29a <DIR> cygwin 01/03/2003 03:18p <DIR> _Inline 7 File(s) 783,976 bytes 27 Dir(s) 1,945,975,296 bytes free C:\>tree /a /f _Inline Folder PATH listing for volume CRAP Volume serial number is 0006FE80 3410:8AA3 C:\_INLINE | config | +---build \---lib \---auto \---FOO_3d5d FOO_3d5d.dll FOO_3d5d.inl C:\>


    MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
    ** The Third rule of perl club is a statement of fact: pod is sexy.

Re: Inline::C error.
by Beatnik (Parson) on Jan 03, 2003 at 23:13 UTC
    First off, you need a C compiler, second.. Inline::C will try to create some really weird looking filenames and directory names. I'm not sure how exactly Inline would work on Windows. You don't need any XS knowledge to use Inline but it may came in handy :)

    BTW: I dropped Inline for XS a while ago so I'm actually not all that much help. Just my $ 0.02 really...

    Greetz
    Beatnik
    ... Quidquid perl dictum sit, altum viditur.

      Would you mind commenting why you dropped Inline::C? I'm currently facing a similar dilemma and I feel more like going with XS since Inline::C adds and additional level to the debugging process (reporting errors in the XS file it automatically generates).

      Thanks in advance, -gjb-

        Well, Inline is nice (Ingy++ for that one), but it requires the extra overhead when compiling/linking. It seemed a bit silly to me of using Inline::C to eventually generate stuff XS does itself. IIRC I benchmarked it somehow and it appeared that pure XS was still faster than Inline (which kinda makes sense). Inline::C was a bit confusing at the time but the ppl on the mailing list were extremly helpfull :) Guess I just like it the old fashioned waytm

        Greetz
        Beatnik
        ... Quidquid perl dictum sit, altum viditur.
Re: Inline::C error.
by Mr. Muskrat (Canon) on Jan 03, 2003 at 22:51 UTC

    If I try to use Inline C in any form or fashion I get the same errors. What version of Perl are you using?

    perl -v

    This is perl, v5.6.1 built for MSWin32-x86-multi-thread (with 1 registered patch, see perl -V for more detail) Copyright 1987-2001, Larry Wall Binary build 633 provided by ActiveState Corp. http://www.ActiveState. +com Built 21:33:05 Jun 17 2002

Re: Inline::C error.
by DigitalKitty (Parson) on Jan 04, 2003 at 01:45 UTC
    Hi all.

    Perl version:
    This is perl, v5.6.1 built for MSWin32-x86-multi-thread (with 1 registered patch, see perl -V for more detail)

    Inline::C version is:
    0.43
    As for a C compiler, I am using DJGPP. The Inline::C module was installed via ppm ( ActiveState ).
    Thanks,
    -Katie.
      I don't know much about Inline::C, but in general, you cannot do that.

      You have to use the compiler perl was compiled with. ActivePerl is compiled using cl (perl -V:cc)

      Either buy Microsoft Visual Studio, or download the perl sourcecode (ActivePerl from http://downloads.activestate.com/), and compile everything yourself from scratch using DJGPP (or Borland's free compiler, see outside links for a link), including Inline::C.

      Do understand that if you do this, using PPM is gonna be pretty much useless, cause all PPM repositories use CL as the compiler (cause if you got a compiler like DJGPP, you don't need PPM).


      MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
      ** The Third rule of perl club is a statement of fact: pod is sexy.

        Thanks PodMaster. That is my problem too then.

      Another way to get at a MS C compiler is to look for the bundled Teaching Edition of MSVC 6 - it comes for about 20$ together with some (bad) books about C++, that's where I got my version of MSVC from. I needed it because I didn't want to spend time hunting compiled versions - now I spend time hunting down a gcc crosscompiler for Win32->Solaris, resp. the Solaris header files :-))

      perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web