whatcanGOwrong

This commit is contained in:
2024-09-19 21:38:24 -04:00
commit d0ae4d841d
17908 changed files with 4096831 additions and 0 deletions
@@ -0,0 +1,35 @@
#include <stdio.h>
#include "_cgo_export.h"
#ifdef __amd64__
#define BREAKPOINT asm("int3;")
#elif __i386__
#define BREAKPOINT asm("int3;")
#elif __PPC64__
#define BREAKPOINT asm("tw 31,0,0;")
#elif __aarch64__
#ifdef WIN32
#define BREAKPOINT asm("brk 0xF000;")
#else
#define BREAKPOINT asm("brk 0;")
#endif
#endif
void helloworld_pt2(int x) {
BREAKPOINT;
helloWorld(x+1);
}
void helloworld(int x) {
helloworld_pt2(x+1);
}
void helloworld_pt4(int x) {
BREAKPOINT;
helloWorld2(x+1);
}
void helloworld_pt3(int x) {
helloworld_pt4(x+1);
}
@@ -0,0 +1,7 @@
#ifndef __HELLO_H__
#define __HELLO_H__
void helloworld(int);
void helloworld_pt3(int);
#endif
@@ -0,0 +1,30 @@
package main
// #include "hello.h"
import "C"
import (
"fmt"
"runtime"
)
func main() {
runtime.Breakpoint()
C.helloworld(2)
}
//export helloWorld
func helloWorld(x C.int) {
helloWorldS(x)
}
func helloWorldS(x C.int) {
runtime.Breakpoint()
C.helloworld_pt3(x - 1)
}
//export helloWorld2
func helloWorld2(x C.int) {
runtime.Breakpoint()
fmt.Printf("hello world %d\n", x)
}