Your question sounds more like a C question than a Perl question.

Now guess what happens: You forget to add your New_Init() and New_Run() to main(), and suddenly, the system behaves very strange. In fact, it is number one on our debugging check list. Number two is wrong order of the init functions. Also, all that hand-written stuff takes a lot of time when you set up a new project.

One idea is to have a single config file in some easy to understand format and have Perl write the .c and .h code for this initialization and loop run code from that.

You have to modify your make file to accommodate that Perl step. In general there is no problem with having a program write another program (Larry Wall says that these are the happiest programs of all).


In reply to Re: [OT] Abusing GNU compiler and linker: Make the linker generate an array of function pointers by Marshall
in thread [OT] Abusing GNU compiler and linker: Make the linker generate an array of function pointers by afoken

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.