Problems with ZEND and DLL and C++

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Olaf Schinkel

    Problems with ZEND and DLL and C++

    Hello!

    I´m not sure if this is the right group...
    .... if not, please tell me the right one.

    Ich compile a DLL with VC6 with the switch /Tc.
    So the DLL compiles as a C DLL.
    This works.
    But I need a class in my DLL.
    When I compile without the switch, it compiles, but PHP says me, that that
    is not a valid PHP DLL.
    Is there an example how to compile a PHP C++ DLL?
    Or can anybody give me a hint?

    Best
    Olaf


  • Chung Leong

    #2
    Re: Problems with ZEND and DLL and C++

    You're developing for PHP4, I bet. The old v4 ZEND_GET_MODULE () macro
    doesn't sandwish its definition in a BEGIN_EXTERN_C( )/END_EXTERN_C()
    pair, so the function it defines is exported with a C++ mangled name.
    Putting a BEGIN_EXTERN_C( ) before ZEND_GET_MODULE () and a
    END_EXTERN_C() after should fix the problem.

    This problem is fixed in the v5 source.

    Comment

    • Olaf Schinkel

      #3
      Re: Problems with ZEND and DLL and C++

      Hello!

      Yes, thank you.
      You know a lot about ZEND.
      Is there a documentation available for ZEND?
      If yes, where?

      Best
      Olaf


      Comment

      • Chung Leong

        #4
        Re: Problems with ZEND and DLL and C++

        Comprehensive documentation? Not really. Just some snippets in the PHP
        manual. You can learn a lot though just by reading the code. A good
        file find utility is very handy for this purpose.

        Comment

        • Olaf Schinkel

          #5
          Re: Problems with ZEND and DLL and C++

          Hello!

          Yes, I read some sourcecodes.
          My C++ DLL ist running now and works good.

          Best
          Olaf


          Comment

          Working...