Skip to content

Instantly share code, notes, and snippets.

@cezarywojcik
Created July 7, 2015 09:08
Show Gist options
  • Save cezarywojcik/2cf9671d61a0f61c85c8 to your computer and use it in GitHub Desktop.
Save cezarywojcik/2cf9671d61a0f61c85c8 to your computer and use it in GitHub Desktop.
Compiling Swift With C Code
default: app
app: c.o s.o
swiftc -o app c.o s.o
c.o: test.h test.c
clang test.c -o c.o -c
s.o: test.swift
swiftc test.swift -o s.o -c -import-objc-header test.h
#include <stdio.h>
void test()
{
printf("Hello, World!\n");
}
#ifndef TEST_H
#define TEST_H
void test();
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment