Building a header file from libraries

Started by
3 comments, last by wack 10 years, 2 months ago
Hello there folks,
I was wondering if anyone might know how I can auto create
a readable header .h file from the following files.
I am thinking it should be possible and should look better than the original .h file.
As, I want developers to be able to add the functionality to there code, 'for free' but They are going to need a .h file.
So, how should I attempt this ?
These are the files I want to generate the header file from :
m_model.dll
m_model.exp
m_model.ilk
m_model.lib
m_model.pdb
Many Thanks in advance,
Advertisement

I'm confused, hang on. You want to generate a .h file that would then allow someone to statically link against m_model.dll? Where did m_model.dll come from? Do you not have the original .h file?

"...and should look better than the original .h file..."

Better in what way?

HI,

I built the m_model dll from my exe but the h file is really long winded and needs lots of tidying up so I was wondering if there is a way to auto generate an h file but it looks like there is no way to do this.

A better way of doing this would be to use ATL I suppose I shall tidy up the exiting h file.

Yeah, you can utilize a combination of dumpbin & dbghelp to do this (and possibly other tools such as libtool). **IF** your DLL is well formed (by that I mean, has a purely functional interface - i.e. you are not able to access member variables in your DLL classes/structs; and you have properly exported the ctors and all objects are allocated on the heap from within the DLL - no stack allocation allowed!), then it will work. Chances are though, your DLL is probably NOT well formed, and so the code that is generated is likely to be horribly broken. If you have the original headers, and you just want to clean them up, then it's best to take this as an opportunity to refactor your headers. It is the safest and easiest option.

Since you have the PDB file, you might be able to use the debughlp API to generate header files.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms679291(v=vs.85).aspx

Part of me would like you to try and then report back here how it went, but I'm gonna agree with the general advice of the others: Don't do it, just refactor your header. :)

This topic is closed to new replies.

Advertisement