From: Garrett Goebel
> From: Marcel Grunauer [mailto:[EMAIL PROTECTED]]
> >
> > > package MyClass;
> > > use Inline::Attributes;
> > >
> > > sub C :INLINE (
> > > void hello()
> > > {
> > > printf("Hello\n");
> > > }
> > > );
> > >
> > > &hello;
> > >
> > > 1;
> > > __END__
> >
> > took me a while to understand what you're doing here, but that's
> > clever - the whole function as the attribute data.
> >
> > Still, I don't see the advantage of that over __C__ sections or
> > just saying 'use Inline C => ...' as you still have to define
> > the whole C function within another construct; the idea was to
> > have the C function look like a perl sub:
>
> No... no real advantage, just gives you easy access to a <<'EOF'.
>
> In a yet to be released version of Attribute::Handlers Damian
> has added support for phasic handlers. With which you could have each:
>
> sub C:INLINE ( ... );
>
> Stuff the ... into a big 'ol string during the CHECK block
> that would be inlined at INIT...
Perhaps mine isn't so hot an idea. Kind of blurs subroutine syntax in not
the best directions. A hash or array might be better. Then you could use
the contents as configuration options.
%C = (AUTO_INCLUDE => '#include "yourheader.h"');
%C :INLINE(
void hello()
{
printf("Hello\n");
}
);
...
%C :INLINE(
int subtract(int x, int y)
{ return x - y; }
);
Or maybe there's a better use for Attributes with regards to Inline.
I wonder if anyone has thought of an Inline rewrite of Attribute::Types.
Something that wouldn't just guarantee that @foo :INTEGER is an array of
integers, but would actually be one. Probably never be any faster, but would
definitely be more economical with memory.