Skip to content

Instantly share code, notes, and snippets.

@xyproto
Created November 26, 2017 03:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xyproto/ee9427dc1bcfc36258fc3a93a8b77580 to your computer and use it in GitHub Desktop.
Save xyproto/ee9427dc1bcfc36258fc3a93a8b77580 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
extern char* go_add(char*, char*) __asm__ ("example.main.Add");
char* __go_string_plus(char *a, char *b) {
char *c = malloc((strlen(a) + strlen(b) + 1));
strcat(c, a);
strcat(c, b);
return c;
}
int main() {
char *x = go_add("hi ", "there");
printf("Result: %s\n", x);
free(x);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment