Can I write a PDO extension with c++ instead of c?(Windows10, PHP7.2)
This is the contents(according to official docs) that a pdo ext should cover:
config.m4 # unix build script
config.w32 # win32 build script
CREDITS
package.xml # meta information about the package
pdo_SKEL.c # standard PHP extension glue
php_pdo_SKEL.h
php_pdo_SKEL_int.h # driver private header
SKEL_dbh.c # contains the implementation of the PDO driver interface
SKEL_stmt.c # contains the implementation of the PDO statement interface
tests/
Can I just rename the pdo_SKEL.c
to pdo_SKEL.cpp
, and also change the c file name to cpp in config.w32.
I tried with some simple code and function, it works. But every time when i want to register the ext to the pdo, the compilation would not pass.
Error LNK2019 unresolved external symbol "int __cdecl php_pdo_register_driver(struct pdo_driver_t *)" (?php_pdo_register_driver@@YAHPEAUpdo_driver_t@@@Z) referenced in function "int __cdecl zm_startup_pdo_my_mysql(int,int)" (?zm_startup_pdo_my_mysql@@YAHHH@Z) pdo_module C:\php\pdo_module.obj 1