Skip to content

Instantly share code, notes, and snippets.

package main
/*
#include "stdio.h"
#pragma pack(1)
typedef struct{
unsigned char a;
char b;
int c;
unsigned int d;
@upsampled
upsampled / packed_cgo3
Created December 10, 2018 19:34
PAcked C struct and CGO blog post example 3
package main
/*
#include "stdio.h"
#pragma pack(1)
typedef struct{
unsigned char a;
char b;
int c;
unsigned int d;
@upsampled
upsampled / packed_cgo1
Created December 10, 2018 19:31
Packed Struct CGO Blog post 1
package main
/*
typedef struct{
unsigned char a;
char b;
int c;
unsigned int d;
char e[10];
}unpacked;
@upsampled
upsampled / Dealing with Packed Struct with CGO
Last active March 10, 2022 13:45
Generating/Altering Packed C Structs in Go
package main
/*
typedef struct{
signed char SChar;
unsigned char UChar;
char Char;
short int SInt;
unsigned short int USInt;
int Int;