But now I need to turn it into a pre-compiled, free-standing loadable moduleNot that it has much to do with your actual problem, but the approach you're taking will fail to create a "free-standing loadable module" - in that it will still depend upon Inline::C.
Nothing necessarily wrong with that. It just struck me as something worth pointing out (in case it *is* relevant to your aims). If you want to avoid the Inline dependency altogether,
InlineX::C2XS can convert your Inline::C code to a suitable XS file, and even write you a stub Makefile.PL and Your_Mod.pm in the process.
As to the actual problem, there's nothing wrong with what you're doing (based on your description), but it *is* highly likely that you are doing *something* wrong. The stuff that you are doing usually works quite well.
Inline::C does throw up some pretty strange errors at times - messages that don't really help you determine exactly what it is that you've done wrong. This could well be another example of that.
Cheers,
Rob