示例#1
0
 def libLinkArgv(self, cmd_argv, files, linkFlags, symbolFile, outputFile):
   argv = cmd_argv + files + linkFlags
   if util.IsMac():
     argv += ['-dynamiclib']
   else:
     argv += ['-shared']
   argv += ['-o', outputFile]
   return argv
示例#2
0
    def generateBinary(self, cx, files):
        argv = self.linker_.command.split(' ')
        argv += files

        if isinstance(self.linker_, MSVC):
            argv.append('/link')
            argv.extend(self.linkFlags(cx))
            argv += [
                '/OUT:' + self.outputFile,
                '/DEBUG',
                '/nologo',
                '/DLL',
            ]
            if self.compiler.debug_symbols:
                argv += ['/DEBUG', '/PDB:"' + self.name_ + '.pdb"']
        elif isinstance(self.linker_, CompatGCC):
            argv.extend(self.linkFlags(cx))
            if util.IsMac():
                argv.append('-dynamiclib')
            else:
                argv.append('-shared')
            argv.extend(['-o', self.outputFile])

        return argv
示例#3
0
class iovec_t(ctypes.Structure):
  _fields_ = [
    ('iov_base', ctypes.c_void_p),
    ('iov_len', ctypes.c_size_t)
  ]

  def __init__(self):
    super(iovec_t, self).__init__()

# Note that msg_socklen_t is not really socklen_t. Darwin uses socklen_t but
# Linux uses size_t, so we alias that.

def Align(n, a):
  return (n + a - 1) & ~(a - 1)

if util.IsMac():
  try:
    sLibC = ctypes.CDLL('libc.dylib', use_errno=True)
  except:
    sLibC = ctypes.CDLL('/usr/lib/libc.dylib', use_errno=True)

  posix_spawn_file_actions_t = ctypes.c_void_p
  pid_t = ctypes.c_int
  msg_socklen_t = ctypes.c_uint
  SOL_SOCKET = 0xffff
  SCM_RIGHTS = 1
  MSG_NOSIGNAL = 0  # Not supported.
  MSG_CTRUNC = 0x20

  def CMSG_NXTHDR(msg, cmsg):
    cmsg_len = cmsg.contents.cmsg_len