Considerations for calling DLL (COM) in php

Source: Internet
Author: User
Considerations for calling DLL (COM) in PHP: 1. In the function parameters, the last parameter function is the return value and must be of the retval type. 2. When passing a string type parameter to an interface, do not use BSTR * type, but use BSTR because BSTR itself is already a pointer. 3. The number 0 in PHP does not correspond to 0 or NULL in CC ++, but has another value. 4. PHP

Considerations for calling DLL (COM) in PHP: 1. In the function parameters, the last parameter function is the return value and must be of the retval type. 2. When passing a string type parameter to an interface, do not use BSTR * type, but use BSTR because BSTR itself is already a pointer. 3. The number 0 in PHP does not correspond to 0 or NULL in C/C ++, but has another value. 4. PHP

Notes for calling DLL (COM) in PHP:
1. In function parameters, the last parameter function is the return value, which must be of the retval type.
2. When passing a string type parameter to an interface, do not use BSTR * type, but use BSTR because BSTR itself is already a pointer.
3. The number 0 in PHP does not correspond to 0 or NULL in C/C ++, but has another value.
4. The NULL String "" in PHP does not correspond to NULL in C/C ++. It is best to determine whether it is a NULL string by calculating whether its length is 0.
5. If the interface output externally can be placed in a class, it is best to put them in a class. The class used in the output interface function is not used to export the function (but in the ATL Project), and the function is unavailable, it is unclear whether the interface is related to whether it is not in the same class.
6. Use: SysAllocString () to allocate space for the string and release it with: SysFreeString (mem. This is not necessary, but many examples on the Internet use this function to allocate and release space.

I am new to PHP and COM. If any of the above statements is incorrect, please leave a message to discuss them.

There are many resources on the Internet for creating DLL files that can be called by PHP. The following connection:

Http://www.360doc.com/content/10/0512/14/722458_27221569.shtml

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.