Skip to content

Instantly share code, notes, and snippets.

@evertonse
Forked from dgalling/add.c
Created September 9, 2024 19:27
Show Gist options
  • Save evertonse/24307c8b354d0faf1599bc712e278514 to your computer and use it in GitHub Desktop.
Save evertonse/24307c8b354d0faf1599bc712e278514 to your computer and use it in GitHub Desktop.
Simple C interop example in swift
int add(int a, int b) {
return a + b;
}
int add(int a, int b);
#!/bin/sh
swiftc -import-objc-header add.h add.c doit.swift
let result = add(1, 1)
print("\(result)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment