Skip to content

Instantly share code, notes, and snippets.

@dgalling
Created September 8, 2024 18:09
Show Gist options
  • Save dgalling/a697ef26e33180d1d197d8e9c9956113 to your computer and use it in GitHub Desktop.
Save dgalling/a697ef26e33180d1d197d8e9c9956113 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