This repository has been archived on 2024-03-07. You can view files and clone it, but cannot push or open issues/pull-requests.
wongola/std/io.cpp

25 lines
517 B
C++

#include "io.hpp"
#include <iostream>
extern "C" std::unique_ptr<wg::Mod> lib_io()
{
auto mod = std::make_unique<wg::Mod>("io");
std::vector<llvm::Type*> params;
auto* ret = llvm::Type::getInt32Ty(mod->context());
auto* ftype = llvm::FunctionType::get(ret, params, false);
llvm::Function::Create(ftype,
llvm::Function::ExternalLinkage,
"hello",
mod->mod());
return mod;
}
extern "C" int hello(int x)
{
return 2 * x + 1;
}