This shows how to easily sandbox a real-world library using WasmBoxC. Specifically we sandbox the zlib compression library.
To follow along with this, you can clone this gist and then do the following commands.
First, get the emsdk:
| # This isn't meant to be a fully featured implementation. It's just a small playground project. | |
| # Use `cmake -Bbuild -S. -GNinja` to generate the project | |
| # Then use `cmake --build build --target package` to generate a .appimage file ready to go | |
| # This project DOES do dangerous things and tries to download the linuxdeploy tool directly. | |
| # When this makes it into IXM, it will be expected that users have the linuxdeploy tool installed to *some* location. | |
| # It will NOT download and execute something from the internet. | |
| cmake_minimum_required(VERSION 3.16) | |
| project(summon-test LANGUAGES CXX VERSION 0.1.0) | |
| add_executable(app) |
This shows how to easily sandbox a real-world library using WasmBoxC. Specifically we sandbox the zlib compression library.
To follow along with this, you can clone this gist and then do the following commands.
First, get the emsdk:
| all: hello hello.fatbin hello.ptx dyload | |
| hello: kernel.cu | |
| nvcc -std=c++11 -arch sm_60 kernel.cu -o hello -lcuda | |
| hello.fatbin: kernel.cu | |
| nvcc -std=c++11 -arch sm_60 kernel.cu -o hello.fatbin --fatbin -lcuda | |
| hello.ptx: kernel.cu | |
| nvcc -std=c++11 -arch sm_60 kernel.cu -o hello.ptx -ptx | |
| dyload: hello.fatbin load.cu | |
| nvcc -std=c++11 -arch sm_60 load.cu -o dyload -lcuda | |
| clean: |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <dlfcn.h> | |
| int main(int argc, char** argv) | |
| { | |
| void *handle; | |
| void (*func_print_name)(const char*); |
| /* | |
| * TOTP: Time-Based One-Time Password Algorithm | |
| * Copyright (c) 2015, David M. Syzdek <[email protected]> | |
| * All rights reserved. | |
| * | |
| * Redistribution and use in source and binary forms, with or without | |
| * modification, are permitted provided that the following conditions are | |
| * met: | |
| * | |
| * 1. Redistributions of source code must retain the above copyright |
| // CUDA-C includes | |
| #include <cuda.h> | |
| #include <stdio.h> | |
| #include "../common/book.h" | |
| extern "C" | |
| int runCudaPart(); | |
| // CODE goes below |