C module stub generator?

M

Marco

Does anyone know of a C stub generator? Prefer open-source and/or free.

This would parse the header .h file and create a .c file with stubbed
out functions.
This is handy for unit testing and interface and test driven
development.

thanks

Marco
 
M

Mark McIntyre

Does anyone know of a C stub generator? Prefer open-source and/or free.

This would parse the header .h file and create a .c file with stubbed
out functions.
This is handy for unit testing and interface and test driven
development.

Not aware of anything that does precisely this, but it'd be trivial to
write in either C or Perl.

There also do exist perl scripts to generate stub functions from
Windows DLLs, and these operate by creating an intermediate file
essentially identical to a header. You could pull the perl down and
examine it.
 
C

Chuck F.

Mark said:
Not aware of anything that does precisely this, but it'd be
trivial to write in either C or Perl.

Why bother? Copy the .h file to a .c file, strip the include
guards and and C++ guards, replace the #defines, and typedefs with
a #include of the .h, and start editing. In fact, copy the .h and
start editing.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
 
M

Marco

Chuck said:
Why bother? Copy the .h file to a .c file, strip the include
guards and and C++ guards, replace the #defines, and typedefs with
a #include of the .h, and start editing. In fact, copy the .h and
start editing.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,172
Latest member
NFTPRrAgenncy
Top