From: Eric Hodel Date: 2012-06-01T03:04:10+09:00 Subject: Re: [C exten] extconf.rg and #ifdef On May 28, 2012, at 03:57, Iņaki Baz Castillo wrote: > Hi, depending whether my Ruby C extension is being compiled on *nix or > Windows, I need some #defines (i.e: OS_UNIX or OS_WIN). > > I see no way in MKMF documentation to generate a #define (based on > RbConfig["host_os"] for example). Do not use host_* values from rbconfig.rb. Use target_* values from rbconfig.rb. Using host_* is wrong. The host_* values come from host that compiled ruby. When ruby is cross-compiled these values won't match the target and your gem will fail to compile. You should use target_* values as these values match the target ruby was compiled for. See: http://sources.redhat.com/autobook/autobook/autobook_261.html