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++
Raw Permalink Normal View History

2023-09-29 09:01:46 +00:00
#include "io.hpp"
#include <iostream>
2023-09-29 16:26:05 +00:00
extern "C" std::unique_ptr<wg::Mod> lib_io()
2023-09-29 09:01:46 +00:00
{
2023-09-29 16:26:05 +00:00
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;
2023-09-29 09:01:46 +00:00
}