Need to learn C, best books?

muppet scott at
Wed Oct 31 20:23:27 GMT 2007

On Oct 31, 2007, at 8:12 AM, Nicholas Clark wrote:

> but then I wondered how hard it is to create CPAN modules that  
> portably
> generate C libraries that other XS code can link against.

If you use DynaLoader, then

     sub dl_load_flags { $^O eq 'darwin' ? 0x00 : 0x01 }

seems to work well enough for making the symbols in your extension's  
object available to other extensions.  Of course you still need to  
locate the extension's .dll for the link line on windows to satisfy  
the brain-dead early 90's must-resolve-all-symbols-at-link-time  
semantics.  This is the approach used by the entire gtk2-perl stack,  
and it works well enough on linux, freebsd, darwin, and win32.   
(Commentary explaining the magical 0x00 and 0x01 values and the 'if  
darwin' lives next to this code in

Or, if you're really evil and want better portability at the expense  
of some startup goo, make your extension return pointers to the  
relevant functions wrapped in SVs that the dependent extensions can  
slurp in at BOOT: and call indirectly.

But you were probably being facetious, and i should stop giving such  

elysse:  You dance better than some.
me:  "Some" what?
elysse:  Some asparagus.

More information about the mailing list