Example #1
0
/**
 * Loads a named systemlib section from the main binary (or DSO)
 * using the label "ext.{hash(name)}"
 *
 * If {name} is not passed, then {m_name} is assumed.
 */
void Extension::loadSystemlib(const std::string& name) {
  std::string n = name.empty() ?
    std::string(m_name.data(), m_name.size()) : name;
  std::string section("ext.");
  section += f_md5(n, false).substr(0, 12).data();
  std::string hhas;
  std::string slib = get_systemlib(&hhas, section, m_dsoName);
  if (!slib.empty()) {
    std::string phpname = s_systemlibPhpName + n;
    CompileSystemlib(slib, phpname);
  }
  if (!hhas.empty()) {
    std::string hhasname = s_systemlibHhasName + n;
    CompileSystemlib(hhas, hhasname);
  }
}
Example #2
0
/**
 * Loads a named systemlib section from the main binary (or DSO)
 * using the label "ext.{hash(name)}"
 *
 * If {name} is not passed, then {m_name} is assumed for
 * builtin extensions.  DSOs pull from the fixed "systemlib" label
 */
void Extension::loadSystemlib(const std::string& name /*= "" */) {
  std::string hhas, slib;
  if (m_dsoName.empty() || !name.empty()) {
    std::string section("ext.");
    section += f_md5(name.empty() ? m_name : name, false).substr(0, 12).data();
    slib = get_systemlib(&hhas, section);
  } else {
    slib = get_systemlib(&hhas, "systemlib", m_dsoName);
  }
  if (!slib.empty()) {
    std::string phpname("systemlib.php.");
    phpname += m_name.data();
    CompileSystemlib(slib, phpname);
  }
  if (!hhas.empty()) {
    std::string hhasname("systemlib.hhas.");
    hhasname += m_name.data();
    CompileSystemlib(hhas, hhasname);
  }
}
Example #3
0
void Extension::loadSystemlib() {
  std::string hhas, slib;
  if (m_dsoName.empty()) {
    std::string section("systemlib.ext.");
    section += m_name.data();
    slib = get_systemlib(&hhas, section);
  } else {
    slib = get_systemlib(&hhas, "systemlib", m_dsoName);
  }
  if (!slib.empty()) {
    std::string phpname("systemlib.php.");
    phpname += m_name.data();
    CompileSystemlib(slib, phpname);
  }
  if (!hhas.empty()) {
    std::string hhasname("systemlib.hhas.");
    hhasname += m_name.data();
    CompileSystemlib(hhas, hhasname);
  }
}
Example #4
0
/**
 * Loads a named systemlib section from the main binary (or DSO)
 * using the label "ext.{hash(name)}"
 *
 * If {name} is not passed, then {m_name} is assumed.
 */
void Extension::loadSystemlib(const std::string& name) {
  std::string n = name.empty() ?
    std::string(m_name.data(), m_name.size()) : name;
#if defined(__CYGWIN__) || defined(__MINGW__) || defined(_MSC_VER)
  std::string section("ext_");
#else
  std::string section("ext.");
#endif
  section += HHVM_FN(md5)(n, false).substr(0, 12).data();
  std::string hhas;
  std::string slib = get_systemlib(&hhas, section, m_dsoName);
  if (!slib.empty()) {
    std::string phpname = s_systemlibPhpName + n;
    CompileSystemlib(slib, phpname);
  }
  if (!hhas.empty()) {
    std::string hhasname = s_systemlibHhasName + n;
    CompileSystemlib(hhas, hhasname);
  }
}