John,

You could use a BEGIN block to choose your INC path at compile time:

#!/usr/bin/perl

use strict ;
use Cwd qw(cwd);

BEGIN {
    $main::INC = '' ;
    if ($^O eq 'linux'){
        $main::INC = "-I" . cwd() . "/linux/" ;
    }
    else {
        $main::INC = "-I" . cwd() . "/windows/" ;
    }
}

use Inline C => Config => INC => $main::INC ;

use Inline(
    C => <<'CODE',
#include <os.h>

void hi(){
 printf("Hello, %s world\n", OS);
}
CODE
) ;

hi();


Patrick


On Tue, Jan 27, 2009 at 4:09 PM, John R. Hogerhuis <jho...@pobox.com> wrote:
> I need parts of
>
> use Inline =>
>
> to be conditional on platform ($^O)
>
> i.e., different LIB and INC name value pairs depending on windows vs linux.
>
> But use happens at compile time.
>
> How do I do this?
>
> thx
>
> -- John.
>



-- 
=====================
Patrick LeBoutillier
Rosemère, Québec, Canada

Reply via email to