By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,261 Members | 1,325 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,261 IT Pros & Developers. It's quick & easy.

C module stub generator?

P: n/a
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

Dec 11 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
On 11 Dec 2005 06:23:37 -0800, in comp.lang.c , "Marco"
<pr**********@yahoo.com> wrote:
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.

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Dec 11 '05 #2

P: n/a
I hacked a stub generator:

visit comp.sources.d

look for cstub

Jan 7 '06 #3

P: n/a
Mark McIntyre wrote:
"Marco" <pr**********@yahoo.com> wrote:
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.


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/>
Jan 7 '06 #4

P: n/a

Chuck F. wrote:
Mark McIntyre wrote:
"Marco" <pr**********@yahoo.com> wrote:
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.


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/>


Jan 9 '06 #5

P: n/a
>
Why bother?


primary reason is to stub out code for unit testing that I am not
creating but need to use (like RTOS calls) or an existing HW interface

Jan 9 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.