1 // =================================
 2 // Copyright (c) 2021 Seppo Laakko
 3 // Distributed under the MIT license
 4 // =================================
 5 
 6 #include <cmajor/cmsxbe/Interface.hpp>
 7 #include <cmajor/cmsxbe/EmittingContext.hpp>
 8 #include <cmajor/cmsxbe/Emitter.hpp>
 9 
10 extern "C" cmajor::ir::EmittingContext* CmsxbeCreateEmittingContext(int optimizationLevel)
11 {
12     return new cmsxbe::EmittingContext(optimizationLevel);
13 }
14 
15 extern "C" void CmsxbeDestroyEmittingContext(cmajor::ir::EmittingContext* emittingContext)
16 {
17     delete emittingContext;
18 }
19 
20 extern "C" cmajor::ir::Emitter* CmsxbeCreateEmitter(void* emittingContext)
21 {
22     cmsxbe::EmittingContext* beEmittingContext = static_cast<cmsxbe::EmittingContext*>(emittingContext);
23     return new cmsxbe::Emitter(beEmittingContext);
24 }
25 
26 extern "C" void CmsxbeDestroyEmitter(cmajor::ir::Emitter* emitter)
27 {
28     delete emitter;
29 }