Skip to content

emitted .h files don't need _WIN32 branch when targeting non-windows platforms #2417

@daurnimator

Description

@daurnimator

e.g.

$ cat life.zig 
export fn meaningoflife() i32 {
   return 42;
}
$ ../zig-linux-x86_64-0.4.0+f8117a07/zig build-obj -target avr-freestanding life.zig 
$ file life.o
life.o: ELF 32-bit LSB relocatable, Atmel AVR 8-bit, version 1 (SYSV), not stripped
$ 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

Windows is never going to support AVR: we shouldn't include the defined(_WIN32) branch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    emit-hThis issue is related to generating .h files for C interop

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions