Giter VIP home page Giter VIP logo

boost.php's People

Contributors

moriyoshi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

boost.php's Issues

Boost.PHP on Windows

Hi there,
This looks very good but there's no example on Windows. Does this works? With VC9?
Thanks
Ricardo

example: using a class but not exposing it?

I've got a bunch of classes that I've written, that I need to be able to use in this PHP module I'm building. For every single class I've written (lots), do I have to put it in the __initialize function and link all of that classes methods, even though I don't want to expose the functionality of that class? The issue I run into is that when I load the .so into PHP and try to run the exposed method, it says "undefined symbol" for the class I've defined in the module. The code compiles just fine. Here's an example:

#include "boost/php/module.hpp"
#include "boost/php/function.hpp"
#include "boost/php/klass.hpp"

using namespace boost;


// --------------------------------

class MyUtilClass {
  public:
    MyUtilClass();
    std::string GetRandomDomain() {
      return "@randomdomain.com";
    }
};

// -------------------------------


class email_gen_module
    : public php::module,
      public php::function_container<email_gen_module> {

  public:
    class handler : public php::module::handler {
      public:
        handler(email_gen_module* mod) : php::module::handler(mod) {}

        std::string getRandomEmail() {
          MyUtilClass c;
          std::string user = "randomuser";
          std::string domain = c.GetRandomDomain();
          return user + domain;
        }

    };


  public:
    email_gen_module(zend_module_entry* entry) : php::module(entry) {
        entry->functions = defun("getRandomEmail", &handler::getRandomEmail);
    }
};

#define BOOST_PHP_MODULE_NAME email_gen_module
#define BOOST_PHP_MODULE_CAPITALIZED_NAME EMAIL_GEN_MODULE
#define BOOST_PHP_MODULE_VERSION "0.1"
#define BOOST_PHP_MODULE_CLASS_NAME email_gen_module

#include "phpboost/module_def.hpp"

Thanks! And thanks for building this C++ interface!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.