Created
May 3, 2019 08:28
-
-
Save daurnimator/d57c49c8e8cb086ba362163d30ba0ab0 to your computer and use it in GitHub Desktop.
zig for AVR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ls | |
life.zig | |
$ cat life.zig | |
export fn meaningoflife() i32 { | |
return 42; | |
} | |
$ ../tmp.fSW3FyeejR/zig-linux-x86_64-0.4.0+f8117a07/zig build-obj -target avr-freestanding life.zig | |
$ cat life.h | |
#ifndef LIFE_H | |
#define LIFE_H | |
#include <stdint.h> | |
#ifdef __cplusplus | |
#define LIFE_EXTERN_C extern "C" | |
#else | |
#define LIFE_EXTERN_C | |
#endif | |
#if defined(_WIN32) | |
#define LIFE_EXPORT LIFE_EXTERN_C __declspec(dllimport) | |
#else | |
#define LIFE_EXPORT LIFE_EXTERN_C __attribute__((visibility ("default"))) | |
#endif | |
LIFE_EXPORT int32_t meaningoflife(void); | |
#endif | |
$ file life.o | |
life.o: ELF 32-bit LSB relocatable, Atmel AVR 8-bit, version 1 (SYSV), not stripped |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment