def compile_cmodule(self, location=None):
"""
This compiles the source code for this linker and returns a
loaded module.
"""
if location is None:
location = cmodule.dlimport_workdir(config.compiledir)
mod = self.get_dynamic_module()
c_compiler = self.c_compiler()
libs = self.libraries()
preargs = self.compile_args()
# We want to compute the code without the lock
src_code = mod.code()
get_lock()
try:
_logger.debug("LOCATION %s", str(location))
module = c_compiler.compile_str(
module_name=mod.code_hash,
src_code=src_code,
location=location,
include_dirs=self.header_dirs(),
lib_dirs=self.lib_dirs(),
libs=libs,
preargs=preargs)
except Exception as e:
e.args += (str(self.fgraph),)
raise
finally:
release_lock()
return module
评论列表
文章目录