File: dlltool.py

package info (click to toggle)
pypy 7.0.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 107,216 kB
  • sloc: python: 1,201,787; ansic: 62,419; asm: 5,169; cpp: 3,017; sh: 2,534; makefile: 545; xml: 243; lisp: 45; awk: 4
file content (41 lines) | stat: -rw-r--r-- 1,451 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

from rpython.translator.c.genc import CBuilder
from rpython.rtyper.lltypesystem.lltype import getfunctionptr
from rpython.translator.tool.cbuild import ExternalCompilationInfo


class CLibraryBuilder(CBuilder):
    standalone = False
    split = True

    def __init__(self, *args, **kwds):
        self.functions = kwds.pop('functions')
        self.name = kwds.pop('name')
        CBuilder.__init__(self, *args, **kwds)

    def getentrypointptr(self):
        entrypoints = []
        bk = self.translator.annotator.bookkeeper
        for f, _ in self.functions:
            graph = bk.getdesc(f).getuniquegraph()
            entrypoints.append(getfunctionptr(graph))
        return entrypoints

    def gen_makefile(self, targetdir, exe_name=None,
                    headers_to_precompile=[]):
        pass # XXX finish

    def compile(self):
        extsymeci = ExternalCompilationInfo()  # empty
        self.eci = self.eci.merge(extsymeci)
        files = [self.c_source_filename] + self.extrafiles
        files += self.eventually_copy(self.eci.separate_module_files)
        self.eci.separate_module_files = ()
        oname = self.name
        self.so_name = self.translator.platform.compile(files, self.eci,
                                                        standalone=False,
                                                        outputfilename=oname)

    def get_entry_point(self, isolated=False):
        return self.so_name