Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

My Frustrating Experience with Inline ::C and Inline::CPP Installation

by talwyn (Monk)
on Dec 17, 2005 at 00:12 UTC ( [id://517413]=perlmeditation: print w/replies, xml ) Need Help??

I had a heck of a time getting the above mentioned modules working in a windows environment. I thought I'd leave a note so someone can see this later.

Problem 1) No matter what I did InLine::C wouldn't work. Even though the module tests passed.

WORKAROUND

First MS compiler does not by default export all the needed variables. Make sure the first time you run your script it is run inside the "Visual Studio .NET 2003 Command Prompt" shell (or make that your default shell).

Additionally, it turns out that Inline::C doesn't play well in paths containing spaces. I don't know why ( it created the _Inline sub dir) but the _Inline directory was always empty. Moving to a separate non space containing path solved this problem and allowed me to compile a Inlined sub. Creating a module from here was easy. ( Also runs from location in standard shell once compiled ), the _Inline dir could presumably be moved after the compilation.

Problem 2 I couldn't get Inline:CPP installed.

WORKAROUND

First All of the problems mentioned above are true for Inline::CPP as well. But even following solution 1 It didn't work. All of the module's tests would fail!

After some detective work in the ruins and in the docs ( of all places!) I found the cause. As it turns out, by default Inline::CPP does not use the ANSI <iostream> header, it uses an older <iostream.h> which Microsoft didn't provide ( shouldn't the ANSI standard be the default header???). I suppose you could copy and rename the ansi header ... but what I did was force the installation to proceed even though the tests were failed, then in your CPP section make the following configuration change: use Inline CPP => Config => ENABLE => STD_IOSTREAM;

Now Inline::CPP uses the right header and is happy. Example script concocted from module examples can now be compiled:

use Inline C; greet(); use Inline CPP => Config => ENABLE => STD_IOSTREAM; use Inline CPP => <<'END'; using namespace std; class JAxH { public: JAxH(char *x); SV* data(); private: SV *dat; }; JAxH::JAxH(char *x) { dat = newSVpvf("Just Another %s Hacker", x); +} SV* JAxH::data() { return dat; } END print JAxH->new('Inline')->data(), "\n"; __END__ __C__ void greet() { printf("Hello, world\n"); }
  • Comment on My Frustrating Experience with Inline ::C and Inline::CPP Installation
  • Download Code

Replies are listed 'Best First'.
Re: My Frustrating Experience with Inline ::C and Inline::CPP Installation
by Madcap Laughs (Acolyte) on Dec 18, 2005 at 23:46 UTC
    Directory names that contain spaces are indeed a problem for Inline - and should be avoided. Other than that, none of those workarounds should be necessary.

    Both modules build and work straight out of the box on Win32 if you're using dmake and the MinGW compiler. With ActiveState build 815, dmake and MinGW can be used seamlessly with ActiveState perl. Otherwise it is better to also install ExtUtils::FakeConfig (if you want to use MinGW with MSVC-built perl).

    However, both Inline::C and Inline::CPP also build and work straight out of the box for me with VC++7.0. (With VC++ 6.0 I think there was some minor difficulty getting Inline::CPP to build - I forget the details.)

    Perhaps your problem is with the "2003" version. The free version you can get from Microsoft is notorious for not giving you everything it should. The 'Readme.win32' file in the perl source distro contains a good account of the extra (free) stuff that needs to be dug up and downloaded. I really don't know why anyone would bother with it, given the comparative ease with which MinGW can be installed. If you're using a purchased version of Visual Studio then, afaik, everything should just simply work fine.

    Can't quite get a handle on your exact details, but it seems likely to me that something in your setup is not right.

    Cheers,
    Rob

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://517413]
Approved by willyyam
Front-paged by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-16 22:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found