Using a DLL With PHP for Dummies

前端 未结 3 761
长发绾君心
长发绾君心 2020-12-08 08:14

I have a project that needs to access a DLL with PHP. The server is a Windows machine and the Apache server is provided by XAMPP.

I read multiple answers on the web

3条回答
  •  孤城傲影
    2020-12-08 09:18

    When you create your DLL file, you need to use a module definition file. It will contain something similar to this:

    ;
    ;contains the list of functions that are being exported from this DLL
    ;
    
    DESCRIPTION     "Simple COM object"
    
    EXPORTS
                    DllGetClassObject       PRIVATE
                    DllCanUnloadNow         PRIVATE
                    DllRegisterServer       PRIVATE
                    DllUnregisterServer     PRIVATE
    

    That definition allows regsvr32 to find the DllRegisterServer entry point.

    Another option you can try is to pass the /n flag to regsvr32.

    Regsvr32 [/u] [/n] [/i[:cmdline]] dllname

    /u - Unregister server

    /i - Call DllInstall passing it an optional [cmdline]; when used with /u calls dll uninstall

    /n - do not call DllRegisterServer; this option must be used with /i

    /s – Silent; display no message boxes (added with Windows XP and Windows Vista)

    Ultimately, before you try to make a DLL work with PHP, you need to be sure your DLL works in general.

提交回复
热议问题