Actually, the
Inline module makes it possible to have C code that is compiled without changing your Makefile.PL on a number of systems. Now, whether the C code itself is portable depends on what it calls (for instance, there is no portable way to determine the number of processors). But it can be possible to make portable C routines that compile across platforms. Here's an example from the Inline::C::Cookbook :
use Inline C => <<'END_C';
void greet() {
printf("Hello, world\n");
}
END_C
greet;