| 1 |
= Build your application with a generated tracer |
| 2 |
|
| 3 |
To build your application with a tracer which barectf |
| 4 |
xref:cli:index.adoc[generates] using https://gcc.gnu.org/[GCC]: |
| 5 |
|
| 6 |
[.cl] |
| 7 |
[verse] |
| 8 |
[.prompt]##$## gcc my-app.c barectf.c |
| 9 |
|
| 10 |
Note that you probably need to build a |
| 11 |
xref:platform:index.adoc[platform] into your application too: |
| 12 |
|
| 13 |
[.cl] |
| 14 |
[verse] |
| 15 |
[.prompt]##$## gcc my-app.c barectf.c platform.c |
| 16 |
|
| 17 |
You can also build the tracer and/or the platform as dynamic libraries |
| 18 |
and link your application to them if your system supports this feature. |
| 19 |
|
| 20 |
[[req]] |
| 21 |
== Compiler requirements |
| 22 |
|
| 23 |
barectf xref:cli:index.adoc[generates] ANSI{nbsp}C code, with the |
| 24 |
exception of a requirement for `stdint.h`, which is part of C99. |
| 25 |
|
| 26 |
If your C{nbsp}standard library doesn't offer `stdint.h`, you need to |
| 27 |
create this file and define the following type definitions: |
| 28 |
|
| 29 |
* `uint8_t` |
| 30 |
* `uint16_t` |
| 31 |
* `uint32_t` |
| 32 |
* `uint64_t` |
| 33 |
* `int8_t` |
| 34 |
* `int16_t` |
| 35 |
* `int32_t` |
| 36 |
* `int64_t` |
| 37 |
|
| 38 |
.Custom `stdint.h`. |
| 39 |
==== |
| 40 |
[source,c] |
| 41 |
---- |
| 42 |
#ifndef _BARECTF_STDINT_H |
| 43 |
#define _BARECTF_STDINT_H |
| 44 |
|
| 45 |
typedef unsigned char uint8_t; |
| 46 |
typedef unsigned short uint16_t; |
| 47 |
typedef unsigned int uint32_t; |
| 48 |
typedef unsigned long uint64_t; |
| 49 |
typedef signed char int8_t; |
| 50 |
typedef signed short int16_t; |
| 51 |
typedef signed int int32_t; |
| 52 |
typedef signed long int64_t; |
| 53 |
|
| 54 |
#endif /* _BARECTF_STDINT_H */ |
| 55 |
---- |
| 56 |
==== |
| 57 |
|
| 58 |
== Supported C{nbsp}compilers |
| 59 |
|
| 60 |
The C{nbsp}code which barectf generates is known to be compilable |
| 61 |
by the following compilers: |
| 62 |
|
| 63 |
* https://gcc.gnu.org/[GCC] and |
| 64 |
G++ (tested with the IA-32, x86-64, MIPS, ARM, and AVR architectures; |
| 65 |
also tested with and without the |
| 66 |
https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html[`+-ansi+` option]) |
| 67 |
|
| 68 |
* https://clang.llvm.org/[Clang] and Clang++ (tested with and without |
| 69 |
the |
| 70 |
https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-ansi[`+-ansi+` option]) |
| 71 |
|
| 72 |
* https://visualstudio.microsoft.com/[Microsoft Visual Studio] 2008 |
| 73 |
(with a <<req,custom `stdint.h`>>) |
| 74 |
|
| 75 |
* Microsoft Visual Studio 2010+ |
| 76 |
|
| 77 |
* https://bellard.org/tcc/[TCC] |
| 78 |
|
| 79 |
* https://github.com/rui314/8cc[8cc] |