Calling a Windows dll from PHP 5.2.3

Posted on 2007-07-28
Last Modified: 2013-12-14
I am using php 5.2.3 and would like to call a windows dll I wrote. The dll is an mfc dll, but the functions are exported as      extern "C" VOID PASCAL EXPORT MyFunction(char* name, char* city).  Any help appreciated.
Question by:dhenderson12
    LVL 9

    Expert Comment

    If your DLL contains a COM server and implements IDispatch, then you should be able to load it.  If not, then you're probably going to have to write a custom PECL/Zend extension to load the DLL.
    LVL 10

    Expert Comment

    these are better handle either with a extension, or in some cases a call to a console application written in C/C++ etc

    Author Comment

    Thanks for the response.  How would I add a com server to my dll and implement IDispatch?  I'm not a MS C++ developer, so I would appreciate some guidance here, maybe some example code I can try.  I'm also unclear how I would call a console app from PHP if I can't call a dll.
    LVL 10

    Accepted Solution

    if it is an MFC then it should be native to C++, you can call those like any other dll. So all you ened to do is start a console application, then in the int main block simply call the function of an external dll, and off you go xD

    to call function from a DLL:

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project ( automates most of the tasks discussed in this article. You can even fin…
    This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now