Tardis / lang / module.h
// SPDX-License-Identifier: MIT
// Copyright (c) 2023 John Watts and the LuminaSensum contributors

#ifndef MODULE_H
#define MODULE_H

#include "types.h"

// Finds a module by its name
// This internally loads the module and dependencies
// A new reference is created for the caller
Object module_find(VmState state, const char *name);

// Frees all modules loaded internally
// You must call this at the end of your program
void modules_free(VmState state);

// The following section is an internal API for use only with
// the compiler's C code generator. Do not use for regular C code.

// Data structure for creating a module
struct module_info {
	const char *name;
	const char **uses;
	Object (*create)(VmState state, Object *use_modules);

typedef const struct module_info ModuleInfo;