Rust / C / Cgo example

Overview

whatever

How to build

(This has been tested on Linux & macOS)

Build the Rust code:

$ cargo build

The library is in ./target/debug/libwhatever.a

Build the Go code:

$ cd go-code/
$ go clean
$ go build -v -x .

Run the Go code:

$ ./whatever

It should print something like:

2021/06/29 19:01:51 Hello from Go
Hello from Rust or whatever. Your string is: The moonlight 🦜
2021/06/29 19:01:51 Rust gave us this string: Yeah allocations, sure
2021/06/29 19:01:51 Rust took back this string: P/, sure
You might also like...
Learn-rust - An in-depth resource to learn Rust 🦀

Learning Rust 🦀 Hello friend! 👋 Welcome to my "Learning Rust" repo, a home for my notes as I'm learning Rust. I'm structuring everything into lesson

A highly modular Bitcoin Lightning library written in Rust. Its Rust-Lightning, not Rusty's Lightning!

Rust-Lightning is a Bitcoin Lightning library written in Rust. The main crate, lightning, does not handle networking, persistence, or any other I/O. Thus, it is runtime-agnostic, but users must implement basic networking logic, chain interactions, and disk storage. More information is available in the About section.

Telegram bot help you to run Rust code in Telegram via Rust playground
Telegram bot help you to run Rust code in Telegram via Rust playground

RPG_BOT (Rust Playground Bot) Telegram bot help you to run Rust code in Telegram via Rust playground Bot interface The bot supports 3 straightforward

`Debug` in rust, but only supports valid rust syntax and outputs nicely formatted using pretty-please
`Debug` in rust, but only supports valid rust syntax and outputs nicely formatted using pretty-please

dbg-pls A Debug-like trait for rust that outputs properly formatted code Showcase Take the following code: let code = r#" [ "Hello, World!

Playing with web dev in Rust. This is a sample Rust microservice that can be deployed on Kubernetes.

Playing with web dev in Rust. This is a sample Rust microservice that can be deployed on Kubernetes.

🐀 Building a federated alternative to reddit in rust

Lemmy A link aggregator / Reddit clone for the fediverse. Join Lemmy · Documentation · Report Bug · Request Feature · Releases · Code of Conduct About

Applied offensive security with Rust
Applied offensive security with Rust

Black Hat Rust - Early Access Deep dive into offensive security with the Rust programming language Buy the book now! Summary Whether in movies or main

Rholang runtime in rust

Rholang Runtime A rholang runtime written in Rust.

Easy-to-use optional function arguments for Rust

OptArgs uses const generics to ensure compile-time correctness. I've taken the liberty of expanding and humanizing the macros in the reference examples.

Owner
Amos Wenger
These days: writing Rust code, then writing articles about said Rust code. I love to teach! Into systems programming, networks, trying to get into hardware.
Amos Wenger
A variation of the solana helloworld program example with a client written in Rust instead of Typescript

Simple Solana Smart Contract Example This repository demonstrates how to create and invoke a program on the Solana blockchain. In Solana the word prog

zeke 56 Dec 26, 2022
An example Kibana plugin written in Rust and Typescript

An example Kibana plugin written in Rust and Typescript

Aleh Zasypkin 3 Dec 24, 2022
Example of reading the BME280 sensor on an ESP32-C3 using Rust

Rust ESP32-C3 BME280 Example of reading the BME280 sensor on an ESP32-C3 using Rust Hardware: ESP32-C3 microcontroller BME280 sensor Breadboard Jump w

Wei-ying Chen 21 Mar 9, 2024
An example of Brainf*** JIT-compiler with only the standard library.

jit-compiler An example of Brainf*** JIT-compiler with only the standard library. Prerequisite Rust(1.56.0-nightly or later, but it must work kind of

Akihito KIRISAKI 18 Jan 22, 2022
The Voting example based on MoonZoon and Solana.

Voting example The Rust-only Voting example based on MoonZoon and Solana. MoonZoon is a Rust Fullstack Framework. Solana is a decentralized blockchain

Martin Kavík 26 Dec 8, 2022
A basic rp2040-hal project with blinky and rtt logging example code.

A basic rp2040-hal project with blinky and rtt logging example code. With this you can quickly get started on a new rp2040 project

rp-rs 202 Jan 6, 2023
Example of structuring a proc macro crate for testability

testing-proc-macros Example of structuring a proc macro crate for testability. See accompanying blog post for details. License Licensed under either o

Ferrous Systems 12 Dec 11, 2022
A example bevy application using bevy-kajiya for its renderer

☀️ bevy-kajiya playground A example bevy application using bevy-kajiya for its renderer NOTE: only tested on Windows. For more context, check out the

Sebastian Hamel 20 Dec 5, 2022
First Git on Rust is reimplementation with rust in order to learn about rust, c and git.

First Git on Rust First Git on Rust is reimplementation with rust in order to learn about rust, c and git. Reference project This project refer to the

Nobkz 1 Jan 28, 2022
A stupid macro that compiles and executes Rust and spits the output directly into your Rust code

inline-rust This is a stupid macro inspired by inline-python that compiles and executes Rust and spits the output directly into your Rust code. There

William 19 Nov 29, 2022