1 /*===-- llvm-c/Object.h - Object Lib C Iface --------------------*- C++ -*-===*/
3 /* The LLVM Compiler Infrastructure */
5 /* This file is distributed under the University of Illinois Open Source */
6 /* License. See LICENSE.TXT for details. */
8 /*===----------------------------------------------------------------------===*/
10 /* This header declares the C interface to libLLVMObject.a, which */
11 /* implements object file reading and writing. */
13 /* Many exotic languages can interoperate with C code but have a harder time */
14 /* with C++ due to name mangling. So in addition to C, this interface enables */
15 /* tools written in such languages. */
17 /*===----------------------------------------------------------------------===*/
19 #ifndef LLVM_C_OBJECT_H
20 #define LLVM_C_OBJECT_H
22 #include "llvm-c/Core.h"
23 #include "llvm/Config/llvm-config.h"
26 #include "llvm/Object/ObjectFile.h"
32 typedef struct LLVMOpaqueObjectFile
*LLVMObjectFileRef
;
34 typedef struct LLVMOpaqueSectionIterator
*LLVMSectionIteratorRef
;
36 LLVMObjectFileRef
LLVMCreateObjectFile(LLVMMemoryBufferRef MemBuf
);
37 void LLVMDisposeObjectFile(LLVMObjectFileRef ObjectFile
);
39 LLVMSectionIteratorRef
LLVMGetSections(LLVMObjectFileRef ObjectFile
);
40 void LLVMDisposeSectionIterator(LLVMSectionIteratorRef SI
);
41 LLVMBool
LLVMIsSectionIteratorAtEnd(LLVMObjectFileRef ObjectFile
,
42 LLVMSectionIteratorRef SI
);
43 void LLVMMoveToNextSection(LLVMSectionIteratorRef SI
);
44 const char *LLVMGetSectionName(LLVMSectionIteratorRef SI
);
45 uint64_t LLVMGetSectionSize(LLVMSectionIteratorRef SI
);
46 const char *LLVMGetSectionContents(LLVMSectionIteratorRef SI
);
54 inline ObjectFile
*unwrap(LLVMObjectFileRef OF
) {
55 return reinterpret_cast<ObjectFile
*>(OF
);
58 inline LLVMObjectFileRef
wrap(const ObjectFile
*OF
) {
59 return reinterpret_cast<LLVMObjectFileRef
>(const_cast<ObjectFile
*>(OF
));
62 inline ObjectFile::section_iterator
*unwrap(LLVMSectionIteratorRef SI
) {
63 return reinterpret_cast<ObjectFile::section_iterator
*>(SI
);
66 inline LLVMSectionIteratorRef
67 wrap(const ObjectFile::section_iterator
*SI
) {
68 return reinterpret_cast<LLVMSectionIteratorRef
>
69 (const_cast<ObjectFile::section_iterator
*>(SI
));
74 #endif /* defined(__cplusplus) */