tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Can tcc -run work with multiple source files?


From: Peng Yu
Subject: Re: [Tinycc-devel] Can tcc -run work with multiple source files?
Date: Sun, 28 Mar 2021 12:44:48 -0500

Thanks. It seems that `tcc main.c print.c -run` should not be allowed,
as argv is not what it should be. Should a call like this be made
illegal?

$ cat main.c
#include "print.h"

int main(int argc, char *argv[]) {
  print(argv[1]);
}
$ cat print.c
#include <stdio.h>

void print(const char *s) {
  puts(s);
}
$ cat print.h
void print(const char *s);
$ tcc main.c print.c
$ ./a.out
(null)
$ tcc main.c print.c -run
main.c
$ tcc print.c -run main.c
(null)

On 3/28/21, Kyryl Melekhin <k.melekhin@gmail.com> wrote:
> Peng Yu <pengyu.ut@gmail.com> wrote:
>
>> Hi,
>>
>> See the following examples, tcc -run does not work with multiple
>> source files. But without -run tcc works as expected. Why -run does
>> not run? Can -run be made to work with multiple source files? Thanks.
>>
>> $ cat main.c
>> #include "print.h"
>>
>> int main() {
>>   print();
>> }
>> $ cat print.c
>> #include <stdio.h>
>>
>> void print() {
>>   puts("Hello World!");
>> }
>> $ tcc -run main.c  print.c
>> tcc: error: undefined symbol '_print'
>> $ tcc main.c  print.c
>> $ ./a.out
>> Hello World!
>>
>
> Hello Peng Yu,
>
> The -run switch must always be last. Due to specifics of tcc
> argument parsing.
>
> $ tcc main.c  print.c -run
>
> This will work.
>
> Regards,
> Kyryl
>
> _______________________________________________
> Tinycc-devel mailing list
> Tinycc-devel@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
>


-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]