SkyLine
  • SkyLine | Introduction
    • Module Overview
    • SkyLine's Development
    • Skyline's Reason
    • SkyLine Syntax
    • SkyLine Concepts
      • Concepts | Modes
  • SkyLine | Technologies
    • Module Overview
    • REPL
      • REPL - Basic usage
      • REPL - Console Design
      • REPL - Commands
    • SLC
      • SLC - What is it
      • SLC - Use cases
      • SLC - Lexical Analysis
      • SLC - Intro To Development
      • SLC - Error System
  • SkyLine | Theory
    • Module Overview
    • Theory | Type Systems
      • Objects | Strings
      • Objects | Integers & Floats
  • SkyLine | Development
    • Module Overview
    • Development | Hello Integers?
  • SL | Hybrid Development
    • Module Overview
    • Hybrid Projects | Advancing
    • Hybrid Projects | Wrapping
    • Hybrid Projects | Using SLC
  • SkyLine | For Abusers
    • SL Abuser | Security Research
    • SL Abuser | Module Overview
    • SL Abuser | Abusing Helps
  • SkyLine Experiments
    • Introduction To Module
      • Caster - IoT Manipulation With SkyLine
        • Caster In Real World Scenarios
          • Cracking The Grounds
        • Caster: Setting Up
        • Caster - Running Caster
        • Caster - Dev Manipulation
          • Caster - Console
          • Caster - Apple Devs
          • Caster - Amazon Devs
          • Caster - Google Devs
          • Caster - Roku Devs
      • SkyNeXt - Hacking The Skies
      • SkyLine - PwnLib
Powered by GitBook
On this page
  1. SL | Hybrid Development

Hybrid Projects | Advancing

In order to get setup with hybrid development we first need to understand exactly what we mean by this. As we mentioned before, hybrid development is the idea of taking multiple programming languages such as Go, C and C++ in this case and fusing them together to create one project. We have already mentioned Foreign Function Interfaces within the programming language but did you know you could also do more with that? Well, what if you wanted to take it further than Go code for plugins? The cool thing about the Go programming language and why we chose to use it for SkyLine was because you can call C directly from Go using CGO!

package main 

/*
#include <stdio.h>

void Hey() {
    printf("%s", "hello world from C to go!");
}
*/
import "C"

func main() {
    C.Hey()
}

// Output: hello world from C to go

Well, cool we have our CGO program but how exactly do we tie this into foreign function interfaces? Well as we mentioned before, all your go program needs to do is interact directly with the backend of the SkyLine programming language. We can modify this program to return the subtraction of an equation using CGO and SkyLine like so!

package main

import (
	SkyEnv "SkyLine/Modules/Backend/SkyEnvironment"
)

/*
#include "stdio.h"

int GrabSub() {
	return 20 - 100;
}

*/
import "C"

func GenerateCall(*SkyEnv.SkyLineEnvironment, ...SkyEnv.SL_Object) SkyEnv.SL_Object {
	res := C.GrabSub()
	return &SkyEnv.SL_Integer{Value: int(res)}
}
// Output : -180

So now when we run the program mixed with a SkyLine LoadPlugin call we will see the output of the function. But what if we wanted to take it further? See, developers like us never really wanted to stop or have a limit, we are here to break rules. So, we built a advanced way to work with C++ and C and Go at the same time and embedded it into SLC. But we will get to utilizing SLC in a second. Lets move onto actually working with C++ and understanding how to call C++ from C essentially building a wrapper.

PreviousModule OverviewNextHybrid Projects | Wrapping

Last updated 1 year ago

Page cover image