25 lines
517 B
C++
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;
|
|
}
|