package services

import (
	"fmt"
	"os/exec"
)

func ccompile(source, dialect string) (out []byte, err error) {
	var standard string
	switch dialect {
	case "ansi":
		standard = "-ansi"
	case "c89":
		standard = "-std=c89"
	case "c90":
		standard = "-std=c90"
	case "c99":
		standard = "-std=c99"
	case "c11":
		standard = "-std=c11"
	}
	out, err = exec.Command(cc, standard, "-pedantic", "-Werror", "-Wall",
		"-pipe", "-fPIC", "-o", fmt.Sprintf("%s.out", source),
		source).CombinedOutput()
	return
}

package services

import (
	"fmt"
	"os/exec"
)

func ccompile(source, dialect string) ([]byte, error) {
	var std string
	switch dialect {
	case "ansi":
		std = "-ansi"
	case "c89":
		std = "-std=c89"
	case "c90":
		std = "-std=c90"
	case "c99":
		std = "-std=c99"
	case "c11":
		std = "-std=c11"
	}
	out, err = exec.Command(cc, std, "-pedantic", "-Werror", "-static",
		"-Wall", "-pipe", "-fPIC", "-o", fmt.Sprintf("%s.out", source),
		source).CombinedOutput()
	return out, err
}

Build with static linking for better memory readout when judging.
Build with static linking for better memory readout when judging.
