Thread overview | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
July 29, 2001 Build import libs from include files | ||||
---|---|---|---|---|
| ||||
Attachments: | 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 |
July 29, 2001 Re: Build import libs from include files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tsoi Yat Shing | I can only say: SUPERB!!!!!!! Thanks Tsio |
July 29, 2001 Re: Build import libs from include files | ||||
---|---|---|---|---|
| ||||
Posted in reply to SStallone | 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 > > |
July 29, 2001 Re: Build import libs from include files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kar Gay Lim | 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 news:9k0ced$2fl3$1@digitaldaemon.com... >> I can only say: >> >> SUPERB!!!!!!! >> >> >> Thanks Tsio >> >> > > |
July 29, 2001 Re: Build import libs from include files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kar Gay Lim | 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
> >
> >
|
August 01, 2001 Re: Build import libs from include files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | 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 > news:9k0ced$2fl3$1@digitaldaemon.com... > >> I can only say: > >> > >> SUPERB!!!!!!! > >> > >> > >> Thanks Tsio > >> > >> > > > > > > |
August 01, 2001 Re: Build import libs from include files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kar Gay Lim | 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 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 > > news:9k0ced$2fl3$1@digitaldaemon.com... > > >> I can only say: > > >> > > >> SUPERB!!!!!!! > > >> > > >> > > >> Thanks Tsio > > >> > > >> > > > > > > > > > > > > |
August 01, 2001 Re: Build import libs from include files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kar Gay Lim | > Yes, I admit I have dual personality - coding both Windows and Linux.
Coding for Win32 and FreeBSD... <g>
Jan
|
August 01, 2001 Re: Build import libs from include files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rajiv Bhagwat | 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 |
August 01, 2001 Re: Build import libs from include files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kar Gay Lim | 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
|
Copyright © 1999-2021 by the D Language Foundation