Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable compiling extensions statically into PHP #904

Merged
merged 4 commits into from
Dec 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion source/pdo_sqlsrv/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,3 @@ if test "$PHP_PDO_SQLSRV" != "no"; then
PHP_ADD_EXTENSION_DEP(pdo_sqlsrv, pdo)
PHP_ADD_BUILD_DIR([$ext_builddir/shared], 1)
fi

6 changes: 5 additions & 1 deletion source/pdo_sqlsrv/pdo_dbh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
// IN THE SOFTWARE.
//---------------------------------------------------------------------------------------------------------------------------------

#include "php_pdo_sqlsrv.h"
extern "C" {
#include "php_pdo_sqlsrv.h"
}

#include "php_pdo_sqlsrv_int.h"

#include <string>
#include <sstream>
Expand Down
28 changes: 27 additions & 1 deletion source/pdo_sqlsrv/pdo_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,18 @@
// IN THE SOFTWARE.
//---------------------------------------------------------------------------------------------------------------------------------

#include "php_pdo_sqlsrv.h"
extern "C" {
#include "php_pdo_sqlsrv.h"
}

#include "php_pdo_sqlsrv_int.h"

#ifdef COMPILE_DL_PDO_SQLSRV
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE();
#endif
ZEND_GET_MODULE(g_pdo_sqlsrv)
#endif

extern "C" {

Expand Down Expand Up @@ -308,3 +314,23 @@ namespace {
{ NULL , 0 } // terminate the table
};
}

// DllMain for the extension.
#ifdef _WIN32
// Only needed if extension is built shared
#ifdef COMPILE_DL_PDO_SQLSRV
BOOL WINAPI DllMain( _In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, LPVOID )
{
switch( fdwReason ) {
case DLL_PROCESS_ATTACH:
// store the module handle for use by client_info and server_info
g_sqlsrv_hmodule = hinstDLL;
break;
default:
break;
}

return TRUE;
}
#endif
#endif
6 changes: 5 additions & 1 deletion source/pdo_sqlsrv/pdo_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
// IN THE SOFTWARE.
//---------------------------------------------------------------------------------------------------------------------------------

#include "php_pdo_sqlsrv.h"
extern "C" {
#include "php_pdo_sqlsrv.h"
}

#include "php_pdo_sqlsrv_int.h"

// Constructor
conn_string_parser:: conn_string_parser( _In_ sqlsrv_context& ctx, _In_ const char* dsn, _In_ int len, _In_ HashTable* conn_options_ht )
Expand Down
6 changes: 5 additions & 1 deletion source/pdo_sqlsrv/pdo_stmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
// IN THE SOFTWARE.
//---------------------------------------------------------------------------------------------------------------------------------

#include "php_pdo_sqlsrv.h"
extern "C" {
#include "php_pdo_sqlsrv.h"
}

#include "php_pdo_sqlsrv_int.h"

// *** internal variables and constants ***

Expand Down
6 changes: 5 additions & 1 deletion source/pdo_sqlsrv/pdo_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
// IN THE SOFTWARE.
//---------------------------------------------------------------------------------------------------------------------------------

#include "php_pdo_sqlsrv.h"
extern "C" {
#include "php_pdo_sqlsrv.h"
}

#include "php_pdo_sqlsrv_int.h"

#include "zend_exceptions.h"

Expand Down
Loading