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

Om mani padme hum

I am newish to Perl and quite new to inline C. I have installed the Inline::C module into my ActiveState Perl 5.8 with XP and it seems to have installed fine. I also have visual studio and can compile in C. When I write:

use Inline C; helloWorld (); __END__ __C__ void helloWorld () { printf("Hello World\n"); }

I get:

Can't open C:\Documents\config for output. No such file or directory at -e line 0 BEGIN failed--compilation aborted. Failed to autogenerate C:\Documents and Settings\Angel\Desktop\inline\ +_Inline\config. at C:\Documents and Settings\Angel\Desktop\inline\test_inline.pl line + 0 INIT failed--call queue aborted, <DATA> line 1.

I get the same message whether I run VB env variables or not and whether I run it from the command line or within Komodo the ActiveState IDE.

I need a hint.

#########################

While I am asking questions, here goes another one. Once I get the inline code to work will I be able to make a .exe with the ActiveState PDK which includes the C code??

Thanks,

Angel

20070423 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips

Replies are listed 'Best First'.
Re: inline c
by bart (Canon) on Apr 22, 2007 at 13:18 UTC
    The problem appears to me to be related to the spaces in your path: the path gets broken off after "C:\Documents" when the full path to the config file is "C:\Documents and Settings\Angel\Desktop\inline\_Inline". (Your script probably resides in "C:\Documents and Settings\Angel\Desktop", hence, the desktop.)

    As a first test, try moving the script file to a location that doesn't have a space in its path, such as "c:\temp". That'll probably work (no guarantees from me), and if it does, we can still figure out a way to make it behave well in you current case. Just make sure first there's no problem anywhere else.

      thanks, as a first test that worked. It then complained that lack of MSVCR80.dll; so put one in it path and now it complains in this way. Runtime Error! Program C:\Perl\bin\perl.exe R6034 An application has made an attempt to load the C runtime library incorreclty. Please contact the applications support team for more information. I have spent about 20 minutes googling that error without umderstand much of what I find. angel
        If you're using ActivePerl, you need to use the compiler that came with VC++/VS version 6. I think MSVCR80.dll is used by newer versions of that compiler (The one from VS2005?) and I think the compiler and the library is not compatible with perl binaries created using VS6.

      Hi,

      I also needed to add that I get this complaint at the command line.

      Had problems bootstrapping Inline module 'test_inline_pl_48d2'

      Can't load 'C:\inline\_Inline\lib/auto/test_inline_pl_48d2/test_inline_pl_48d2.dll' for
      module test_inline_pl_48d2: load_file:A dynamic link library (DLL) initialization routine failed at C:/Perl/lib/DynaLoader.pm line 230.
      at C:/Perl/site/lib/Inline.pm line 500

      at C:/Perl/lib/DynaLoader.pm line 0 INIT failed--call queue aborted.

      and that going to the dyanloader.pm line 230 gives this:

      # Many dynamic extension loading problems will appear to come from
      # this section of code: XYZ failed at line 123 of DynaLoader.pm.
      # Often these errors are actually occurring in the initialisation
      # C code of the extension XS file. Perl reports the error as being
      # in this perl code simply because this was the last perl code
      # it executed.
      my $libref = dl_load_file($file, $module->dl_load_flags) or
      croak("Can't load '$file' for module $module: ".dl_error());

      I have only read a bit about XS and most of what i read said to avoid it and use the Inline::C

      Angel

      Hey! I can be trained!!

A reply falls below the community's threshold of quality. You may see it by logging in.