mirror of https://github.com/dnomd343/klotski.git
Dnomd343
4 weeks ago
6 changed files with 52 additions and 0 deletions
@ -0,0 +1,7 @@ |
|||
#include "demo.h" |
|||
|
|||
#include <stdio.h> |
|||
|
|||
void hello() { |
|||
printf("hello from c\n"); |
|||
} |
@ -0,0 +1,7 @@ |
|||
#include "demo.h" |
|||
|
|||
#include <iostream> |
|||
|
|||
void hello() { |
|||
std::cout << "hello from c++" << std::endl; |
|||
} |
@ -0,0 +1,11 @@ |
|||
#pragma once |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
void hello(); |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
@ -0,0 +1,13 @@ |
|||
package main |
|||
|
|||
/* |
|||
#cgo LDFLAGS: -L${SRCDIR}/ -ldemo -lstdc++ |
|||
#include "demo.h" |
|||
*/ |
|||
import "C" |
|||
import "fmt" |
|||
|
|||
func main() { |
|||
fmt.Println("hello from go") |
|||
C.hello() |
|||
} |
@ -0,0 +1,7 @@ |
|||
gcc -O3 -c demo.c -o demo.o |
|||
ar rcs libdemo.a demo.o |
|||
rm -f demo.o |
|||
ranlib libdemo.a |
|||
|
|||
go run klotski.go |
|||
rm -f libdemo.a |
@ -0,0 +1,7 @@ |
|||
g++ -O3 -c demo.cc -o demo.o |
|||
ar rcs libdemo.a demo.o |
|||
rm -f demo.o |
|||
ranlib libdemo.a |
|||
|
|||
go run klotski.go |
|||
rm -f libdemo.a |
Loading…
Reference in new issue