1/*===-- llvm-c/Support.h - Support C Interface --------------------*- C -*-===*\
2|* *|
3|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
4|* Exceptions. *|
5|* See https://llvm.org/LICENSE.txt for license information. *|
6|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
7|* *|
8|*===----------------------------------------------------------------------===*|
9|* *|
10|* This file defines the C interface to the LLVM support library. *|
11|* *|
12\*===----------------------------------------------------------------------===*/
13
14#ifndef LLVM_C_SUPPORT_H
15#define LLVM_C_SUPPORT_H
16
17#include "llvm-c/DataTypes.h"
18#include "llvm-c/ExternC.h"
19#include "llvm-c/Types.h"
20#include "llvm-c/Visibility.h"
21
22LLVM_C_EXTERN_C_BEGIN
23
24/**
25 * @addtogroup LLVMCCore
26 *
27 * @{
28 */
29
30/**
31 * This function permanently loads the dynamic library at the given path.
32 * It is safe to call this function multiple times for the same library.
33 *
34 * @see sys::DynamicLibrary::LoadLibraryPermanently()
35 */
36LLVM_C_ABI LLVMBool LLVMLoadLibraryPermanently(const char *Filename);
37
38/**
39 * This function parses the given arguments using the LLVM command line parser.
40 * Note that the only stable thing about this function is its signature; you
41 * cannot rely on any particular set of command line arguments being interpreted
42 * the same way across LLVM versions.
43 *
44 * Library options, which passes read from their LLVMContext, apply to contexts
45 * that the C API creates afterwards, including the global context, which is
46 * created on first use.
47 *
48 * @see llvm::cl::ParseCommandLineOptions()
49 */
50LLVM_C_ABI void LLVMParseCommandLineOptions(int argc, const char *const *argv,
51 const char *Overview);
52
53/**
54 * Like LLVMParseCommandLineOptions() but returns non-zero and sets
55 * *ErrorMessage on error. Use LLVMDisposeMessage to free the error message.
56 */
57LLVM_C_ABI LLVMBool
58LLVMParseCommandLineOptionsWithError(int argc, const char *const *argv,
59 const char *Overview, char **ErrorMessage);
60
61/**
62 * This function will search through all previously loaded dynamic
63 * libraries for the symbol \p symbolName. If it is found, the address of
64 * that symbol is returned. If not, null is returned.
65 *
66 * @see sys::DynamicLibrary::SearchForAddressOfSymbol()
67 */
68LLVM_C_ABI void *LLVMSearchForAddressOfSymbol(const char *symbolName);
69
70/**
71 * This functions permanently adds the symbol \p symbolName with the
72 * value \p symbolValue. These symbols are searched before any
73 * libraries.
74 *
75 * @see sys::DynamicLibrary::AddSymbol()
76 */
77LLVM_C_ABI void LLVMAddSymbol(const char *symbolName, void *symbolValue);
78
79/**
80 * @}
81 */
82
83LLVM_C_EXTERN_C_END
84
85#endif
86