c++.command-line - Build import libs from include files
- "Tsoi Yat Shing" <kt199623 kt1.hkcampus.net> Jul 28 2001
- "SStallone" <sstallone gmx.de> Jul 29 2001
- "Kar Gay Lim" <kagay kimay.net> Jul 29 2001
- "Walter" <walter digitalmars.com> Jul 29 2001
- "Kar Gay Lim" <kagay kimay.net> Aug 01 2001
- "Rajiv Bhagwat" <dataflow vsnl.com> Aug 01 2001
- Jan Knepper <jan smartsoft.cc> Aug 01 2001
- "Kar Gay Lim" <kagay kimay.net> Aug 02 2001
- Arjan Knepper <arjan jak.nl> Aug 02 2001
- Jan Knepper <jan smartsoft.cc> Aug 01 2001
- Arjan Knepper <arjan jak.nl> Aug 01 2001
- Jan Knepper <jan smartsoft.cc> Jul 29 2001
I have written three scripts to build import libraries from include files. Here are the steps to build gdi32.lib as an example: 1) extract the function declaractions by 'awk -f getfunc.awk wingdi.h > gdi32.f' 2) implement the function by 'awk -f getsrc.awk gdi32.f > gdi32.c' which for example changes 'WINGDIAPI int WINAPI AddFontResourceA(LPCSTR);' to 'int WINAPI AddFontResourceA(LPCSTR var1) {}' 3) obtain gdi32.def by 'awk -f getdef.awk gdi32.f > gdi32.def' 4) obtain gdi32.lib by 'sc gdi32.c -mn -WD -L/IMPL:gdi32.lib' 5) delete gdi32.dll As the scripts are not perfect, there may be errors during the compilation. To minimize the no. of errors, you can use preprocessed include files instead. Here is an example to get a preprocessed wingdi.h file: 1) put a line '#include <windows.h>' into a temporary file, eg, temp.c 2) make a listfile by 'sc temp.c -mn -WD -e -ltemp' which produces temp.lst 3) extract the part belonging to wingdi.h by 'awk "/#ifndef.*WINGDI/,/#endif.*WINGDI/ { print $0 }" temp.lst > gdi32.h' 4) follow the above steps to build import library The principle of this method is to simulate the way which the original library builder used to build his import library by using functions without codes. There are some points to note: 1) As this method does not involve DLL, we must ensure that the functions present inside the include file are also present in the DLL, otherwise, there will be runtime error. For example, in the example above, there may be runtime error if the functions 'wgl*' in wingdi.h are not present in gdi32.dll. If this happens, you should comment or delete the lines in gdi32.def. This problem should be able to solve by writing a program which uses the export data in DLL and deletes the unknown functions 2) The scripts only work on C 3) There is no ordinal value written in .def files, therefore, the functions can only be linked by name I hope that the scripts are helpful for everybody who need to make import libraries themselves
Jul 28 2001
Dear Jan and Walter, Is there a knowledge base or central area tips and tools can be "deposited" ? SStallone <sstallone gmx.de> wrote in message news:9k0ced$2fl3$1 digitaldaemon.com...I can only say: SUPERB!!!!!!! Thanks Tsio
Jul 29 2001
That's a good idea. I think we should build one! Kar Gay Lim wrote in message <9k136m$2rt8$1 digitaldaemon.com>...Dear Jan and Walter, Is there a knowledge base or central area tips and tools can be "deposited" ? SStallone <sstallone gmx.de> wrote in message
I can only say: SUPERB!!!!!!! Thanks Tsio
Jul 29 2001
Actually, I have written a web based FAQ system and upload/download utilities. Unfortunately it is written for Linux/Apache/CGI. Yes, I admit I have dual personality - coding both Windows and Linux. Walter <walter digitalmars.com> wrote in message news:9k1e9g$31h7$1 digitaldaemon.com...That's a good idea. I think we should build one! Kar Gay Lim wrote in message <9k136m$2rt8$1 digitaldaemon.com>...Dear Jan and Walter, Is there a knowledge base or central area tips and tools can be "deposited" ? SStallone <sstallone gmx.de> wrote in message
I can only say: SUPERB!!!!!!! Thanks Tsio
Aug 01 2001
Kar Gay Lim <kagay kimay.net> wrote in message news:9k8rag$15c3$1 digitaldaemon.com...Actually, I have written a web based FAQ system and upload/download utilities. Unfortunately it is written for Linux/Apache/CGI.
Where is it? Can we take a look atleast?Yes, I admit I have dual personality - coding both Windows and Linux.
I guess most of us program (or will be) programming for both os's. I test my CGI code on dmc first (under Win Apachi) and then port it to Linux. I have been wanting to ask Walter, so here goes: Any plans for generating code for Linux? So that the porting of existing (dmc based) code is minimised.....Walter <walter digitalmars.com> wrote in message
That's a good idea. I think we should build one! Kar Gay Lim wrote in message <9k136m$2rt8$1 digitaldaemon.com>...Dear Jan and Walter, Is there a knowledge base or central area tips and tools can be "deposited" ? SStallone <sstallone gmx.de> wrote in message
I can only say: SUPERB!!!!!!! Thanks Tsio
Aug 01 2001
Rajiv Bhagwat wrote:Kar Gay Lim <kagay kimay.net> wrote in message news:9k8rag$15c3$1 digitaldaemon.com...Actually, I have written a web based FAQ system and upload/download utilities. Unfortunately it is written for Linux/Apache/CGI.
Where is it? Can we take a look atleast?
That would be nice.Yes, I admit I have dual personality - coding both Windows and Linux.
I guess most of us program (or will be) programming for both os's. I test my CGI code on dmc first (under Win Apachi) and then port it to Linux. I have been wanting to ask Walter, so here goes: Any plans for generating code for Linux? So that the porting of existing (dmc based) code is minimised.....
I guess we would be surprized! <g> I actually am more fond of the BSD's that Linux, but it seems that most compiles and runs on both anyways. digitalmars.com is actually hosted on FreeBSD 4.3 in case you didn't know running Apache. (Check http://www.netcraft.com/ on it if you want). I usually run into the pain that thing that compile so smoothly with DMC++ break GNU C-- Jan
Aug 01 2001
Shouldn't all these be moved the c++.chat? I am cross posting to it now...... Jan Knepper <jan smartsoft.cc> wrote in message news:3B681D36.D37021E9 smartsoft.cc...Rajiv Bhagwat wrote:Where is it? Can we take a look atleast?
That would be nice.
Yeh, I'll set up one sample site and find some time to convert an old old Digital Dual Pentium 133 box into FreeBSD to see I can port it quickly. I kind of like the FreeBSD's way of handling extended file seek function.... (64-bit offset thing). Too busy writing Win32 stuff nowadays.I actually am more fond of the BSD's that Linux, but it seems that most compiles and runs on both anyways. digitalmars.com is actually hosted on FreeBSD 4.3 in case you didn't know running Apache. (Check http://www.netcraft.com/ on it if you want).
Yep, seen it: telnet www.digitalmars.com 80 Trying 63.105.9.61... Connected to digitalmars.com. Escape character is '^]'. HEAD / HTTP/1.1 HTTP/1.0 200 OK Connection: close Date: Thu, 02 Aug 2001 12:06:10 GMT Server: Apache/1.3.12 (Unix) Content-Type: text/html Connection closed by foreign host. Arjan Knepper <arjan jak.nl> wrote in message news:3B684ADD.6AF6CCAB jak.nl...Windows and FreeBSD. Lots of FreeBSD right now. I boy wouldn't it be great to have
on *BSD and GNU/Linux platforms.....
This is a Walter thing. (hint hint hint). Personally I would love to have DMC++ generating code for micros like those NEC V850 and VR series. This is a "big" market for Windows CE stuff. I am still doing it in C (oh yes, another personality I am in). Have you tried Wine on Linux/FreeBSD? May be we can run DMC++ that way....
Aug 02 2001
Kar Gay Lim wrote:Shouldn't all these be moved the c++.chat? I am cross posting to it now......
So do I..Jan Knepper <jan smartsoft.cc> wrote in message news:3B681D36.D37021E9 smartsoft.cc...Rajiv Bhagwat wrote:Where is it? Can we take a look atleast?
That would be nice.
Yeh, I'll set up one sample site and find some time to convert an old old Digital Dual Pentium 133 box into FreeBSD to see I can port it quickly. I kind of like the FreeBSD's way of handling extended file seek function.... (64-bit offset thing). Too busy writing Win32 stuff nowadays.I actually am more fond of the BSD's that Linux, but it seems that most compiles and runs on both anyways. digitalmars.com is actually hosted on FreeBSD 4.3 in case you didn't know running Apache. (Check http://www.netcraft.com/ on it if you want).
Yep, seen it: telnet www.digitalmars.com 80 Trying 63.105.9.61... Connected to digitalmars.com. Escape character is '^]'. HEAD / HTTP/1.1 HTTP/1.0 200 OK Connection: close Date: Thu, 02 Aug 2001 12:06:10 GMT Server: Apache/1.3.12 (Unix) Content-Type: text/html Connection closed by foreign host. Arjan Knepper <arjan jak.nl> wrote in message news:3B684ADD.6AF6CCAB jak.nl...Windows and FreeBSD. Lots of FreeBSD right now. I boy wouldn't it be great to have
on *BSD and GNU/Linux platforms.....
This is a Walter thing. (hint hint hint). Personally I would love to have DMC++ generating code for micros like those NEC V850 and VR series. This is a "big" market for Windows CE stuff. I am still doing it in C (oh yes, another personality I am in). Have you tried Wine on Linux/FreeBSD? May be we can run DMC++ that way....
Command line compiler runs, idde does not, at least not on FreeBSD-STABLE. Arjan
Aug 02 2001
Yes, I admit I have dual personality - coding both Windows and Linux.
Coding for Win32 and FreeBSD... <g> Jan
Aug 01 2001
Kar Gay Lim wrote:Yes, I admit I have dual personality - coding both Windows and Linux.
Windows and FreeBSD. Lots of FreeBSD right now. I boy wouldn't it be great to have DMC/C++ on *BSD and GNU/Linux platforms..... Arjan
Aug 01 2001
What exactly are you thinking about??? Any examples??? Jan Kar Gay Lim wrote:Dear Jan and Walter, Is there a knowledge base or central area tips and tools can be "deposited" ? SStallone <sstallone gmx.de> wrote in message news:9k0ced$2fl3$1 digitaldaemon.com...I can only say: SUPERB!!!!!!! Thanks Tsio
Jul 29 2001