[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Sugggestion: Add lib type *.c fortcc_add_library() on
From: |
lifenjoiner |
Subject: |
Re: [Tinycc-devel] Sugggestion: Add lib type *.c fortcc_add_library() on windows ('-l' option parse) |
Date: |
Wed, 18 Jun 2014 17:04:09 +0800 |
Hi,
>
> >
> > I work on win platform.
> >
> > As tcc can't use gcc's library (*.a) file, tcc can use *.def file (ONLY) for
> > dynamic link avoid making the library files.
> >
> > For many libraries small or simple, I think tcc also should can use *.c file
> > (ONLY) as library.
>
> I don't know Windows very well but this looks very strange. A .c file is a
> source file and must be compiled first.
On win, TCC can use all needed files as c files, do a runtime compilation, and
then link.
The patch is only for win.
>
> >
> > For complicated case, library contains *.def and *.c files (BOTH), I think
> > tcc can try "*.def + *.c" instead of *.a as library.
>
> And what should it do in this case? Compile it and link it?
For example:
1. use API in ws2_32.dll or shell32.dll
We can use mingw's w32api. It should contents *.h files and
"dllname".def and "dllname".c files. The "dllname".c file declares global
constant and/or CLSID for COM interface. We don't need to declare them again in
our own project.
Before this patch, we need compile "dllname".def and "dllname".c to
"name".o file, and then make it to "libname".a as the library. So we can use -l
option to use it.
With this patch, we won't need to make the "libname".a library, and
also can use -l option. It will search for the *.def file, if succeed it will
do an extra search for the *.c file.
In addition, the w32api's lib is not easy to build up for TCC and most
*.def files are not necessary to transform to *.a files.
2. getopt library or similar thing
Windows don't have it. TCC need the complete codes, should content
getopt.h and getopt.c. If they are in TCC's include and lib search path, we can
use -l option to use the c file as library.
When we immigrate codes from UNIX or Linux, there are many
unpredictable needs that should be put in extra libraries. Codes need
improvement times. Leave them as the original c codes could be more convenient.
I say "scripts" meant text files. It could be something like python.
And compiled libraries are also acceptable.
I use my patched version all the time. It works well.
>
> >
> > So tcc can use all files as scripts. I used shell scripts for this purpose
> > before. :p
>
> Sorry I don't understand this sentence.
>
> >
> > My changes on "libtcc.c" are bellow:
>
> Have you tried your patch on a real example? Can you give us a concrete
> example/scenario with what files are present and what would happen with and
> without your patch?
>
> Best regards,
>
> Thomas
- [Tinycc-devel] Sugggestion: Add lib type *.c for tcc_add_library() on windows ('-l' option parse), lifenjoiner, 2014/06/15
- Re: [Tinycc-devel] Sugggestion: Add lib type *.c for tcc_add_library() on windows ('-l' option parse), Thomas Preud'homme, 2014/06/17
- Re: [Tinycc-devel] Sugggestion: Add lib type *.c fortcc_add_library() on windows ('-l' option parse),
lifenjoiner <=
- Re: [Tinycc-devel] Sugggestion: Add lib type *.c fortcc_add_library() on windows ('-l' option parse), grischka, 2014/06/18
- Re: [Tinycc-devel] Sugggestion: Add lib type *.c fortcc_add_library() on windows ('-l' option parse), lifenjoiner, 2014/06/18
- Re: [Tinycc-devel] Sugggestion: Add lib type *.c for tcc_add_library() on windows ('-l' option parse), lifenjoiner, 2014/06/18
- Re: [Tinycc-devel] Sugggestion: Add lib type *.c for tcc_add_library() on windows ('-l' option parse), grischka, 2014/06/18
- Re: [Tinycc-devel] Sugggestion: Add lib type *.c for tcc_add_library() on windows ('-l' option parse), lifenjoiner, 2014/06/19