Skip to content

Unable to compile c file with system headers without including tinycc's win32 headers on windows #14545

Description

@CrazyboyQCD

What version of Bun is running?

1.3.3+274e01c73

What platform is your computer?

Microsoft Windows NT 10.0.22000.0 x64

What steps can reproduce the bug?

rand.c:

#include <stdlib.h>

int crand() { return rand(); }

test.js:

import { cc } from "bun:ffi";

const cExports = cc({
  source: "./rand.c",
  symbols: {
    crand: {
      returns: "int",
      args: [],
    },
  },
})

Command:

bun run test.js

What is the expected behavior?

Compile successfully.

What do you see instead?

Output:

./rand.c:1: error: include file 'stdlib.h' not found

Additional information

Related with #14014.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbun.jsSomething to do with a Bun-specific APIbun:ffiSomething related with FFI in Bun

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions