Last active
August 29, 2015 14:00
-
-
Save todd/477bea7bc30ae91f1fcd to your computer and use it in GitHub Desktop.
Go-libmpdclient Binding Test
This file contains 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 | |
/* | |
#cgo pkg-config: libmpdclient | |
#include <stdlib.h> | |
#include <mpd/client.h> | |
*/ | |
import "C" | |
import ( | |
"unsafe" | |
"fmt" | |
) | |
func main() { | |
host := C.CString("127.0.0.1") | |
fmt.Println(host) | |
conn := C.mpd_connection_new(host, 0, 0) | |
fmt.Println(C.mpd_connection_get_error(conn)) | |
status := C.mpd_run_status(conn) | |
song_id := C.mpd_status_get_song_id(status) | |
fmt.Println(int(song_id)) | |
C.mpd_status_free(status) | |
C.mpd_connection_free(conn) | |
C.free(unsafe.Pointer(host)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment