This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
//#include<stdio.h> | |
//void inC() { | |
// printf("I am in C code now!\n"); | |
//} | |
import "C" | |
import "fmt" | |
func main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ifaddrs.h> | |
// http://stackoverflow.com/questions/25626117/how-to-get-ip-address-in-swift | |
func getIFAddresses() -> [String] { | |
var addresses = [String]() | |
// Get list of all interfaces on the local machine: | |
var ifaddr : UnsafeMutablePointer<ifaddrs> = nil | |
if getifaddrs(&ifaddr) == 0 { | |