Hi
here is my error:
error LNK2001: unresolved external symbol __imp__executor_globals_id
when I compiling my c++ php extension.
My setting is:
I use php5.lib as additional library
my processor: WIN32;NDEBUG;_WINDOWS;_USRDLL;PHP_WIN32;ZEND_WIN32;ZTS=0;ZEND_DEBUG=0
and include directories:
C:\php-sdk\php53dev\vc9\x86\php5.3-xyz\Release\php-5.3.19-devel-VC9-x86\include";"
C:\php-sdk\php53dev\vc9\x86\php5.3-xyz\Release\php-5.3.19-devel-VC9-x86\include\win32";"
C:\php-sdk\php53dev\vc9\x86\php5.3-xyz\Release\php-5.3.19-devel-VC9-x86\include\TSRM";"
C:\php-sdk\php53dev\vc9\x86\php5.3-xyz\Release\php-5.3.19-devel-VC9-x86\include\zend";"
C:\php-sdk\php53dev\vc9\x86\php5.3-xyz\Release\php-5.3.19-devel-VC9-x86\include\main"
I configured as this link
https://wiki.php.net/internals/windows/stepbystepbuild step by step and
using Windows SDK 6.1
hi,
nmake clean
configure ....
make
You are building it again while having configured&built for another mode.
Hi
here is my error:
error LNK2001: unresolved external symbol __imp__executor_globals_idwhen I compiling my c++ php extension.
My setting is:
I use php5.lib as additional library
my processor: WIN32;NDEBUG;_WINDOWS;_USRDLL;PHP_WIN32;ZEND_WIN32;ZTS=0;ZEND_DEBUG=0and include directories:
C:\php-sdk\php53dev\vc9\x86\php5.3-xyz\Release\php-5.3.19-devel-VC9-x86\include";"
C:\php-sdk\php53dev\vc9\x86\php5.3-xyz\Release\php-5.3.19-devel-VC9-x86\include\win32";"
C:\php-sdk\php53dev\vc9\x86\php5.3-xyz\Release\php-5.3.19-devel-VC9-x86\include\TSRM";"
C:\php-sdk\php53dev\vc9\x86\php5.3-xyz\Release\php-5.3.19-devel-VC9-x86\include\zend";"
C:\php-sdk\php53dev\vc9\x86\php5.3-xyz\Release\php-5.3.19-devel-VC9-x86\include\main"I configured as this link
https://wiki.php.net/internals/windows/stepbystepbuild step by step and
using Windows SDK 6.1
--
Pierre
@pierrejoye | http://blog.thepimp.net | http://www.libgd.org
I did it but have error still
note: I compile none thread safe and got error when using some user
function in my c++ code.
hi,
nmake clean
configure ....
makeYou are building it again while having configured&built for another mode.
Hi
here is my error:
error LNK2001: unresolved external symbol __imp__executor_globals_idwhen I compiling my c++ php extension.
My setting is:
I use php5.lib as additional library
my processor:
WIN32;NDEBUG;_WINDOWS;_USRDLL;PHP_WIN32;ZEND_WIN32;ZTS=0;ZEND_DEBUG=0and include directories:
C:\php-sdk\php53dev\vc9\x86\php5.3-xyz\Release\php-5.3.19-devel-VC9-x86\include";"
C:\php-sdk\php53dev\vc9\x86\php5.3-xyz\Release\php-5.3.19-devel-VC9-x86\include\win32";"
C:\php-sdk\php53dev\vc9\x86\php5.3-xyz\Release\php-5.3.19-devel-VC9-x86\include\TSRM";"
C:\php-sdk\php53dev\vc9\x86\php5.3-xyz\Release\php-5.3.19-devel-VC9-x86\include\zend";"
C:\php-sdk\php53dev\vc9\x86\php5.3-xyz\Release\php-5.3.19-devel-VC9-x86\include\main"
I configured as this link
https://wiki.php.net/internals/windows/stepbystepbuild step by step and
using Windows SDK 6.1--
Pierre@pierrejoye | http://blog.thepimp.net | http://www.libgd.org
hi,
I did it but have error still
note: I compile none thread safe and got error when using some user function
in my c++ code.
Not sure what you do in your code but this is typically the error
while trying to link/build TS objects while working with a NTS
configuration.
Does it happen in PHP or in your ext? Please show the full error message.
Cheers,
Pierre
@pierrejoye | http://blog.thepimp.net | http://www.libgd.org
Here is my source code:
/worked on php 5.3*/
#define PHP_COMPILER_ID "VC9"
#include<iostream>
#include <string>
#include <stdio.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "php_ini.h"
ZEND_FUNCTION(my_function);
PHP_FUNCTION(ig_reverseString);
PHP_FUNCTION(ig_parseString);
PHP_FUNCTION(ig_connect_to_database);
PHP_FUNCTION(get_global_server_variable);
zend_function_entry ig_functions[] =
{
ZEND_FE(my_function, NULL)
PHP_FE(ig_reverseString, NULL)
PHP_FE(ig_parseString, NULL)
PHP_FE(ig_connect_to_database, NULL)
PHP_FE(get_global_server_variable, NULL)
{NULL, NULL, NULL}
};
zend_module_entry my_function_module_entry =
{
STANDARD_MODULE_HEADER,
"my_function_License",
ig_functions,
NULL, NULL, NULL, NULL, NULL,
"4.2.29",
STANDARD_MODULE_PROPERTIES
};
ZEND_GET_MODULE(my_function);
ZEND_FUNCTION(my_function)
{
bool my_functionLicense;
if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b",
&my_functionLicense) == FAILURE)
{
E_ERROR;
return;
}
if(my_functionLicense)
{
php_printf("license is OK!<br/>");
}
else
{
php_printf("an error occure!!! please contact my_function admin<br/>");
}
return;
}
PHP_FUNCTION(ig_reverseString)
{
char input = NULL;
int argc = ZEND_NUM_ARGS();
int input_len;
char workstr;
int index;
if(zend_parse_parameters(argc TSRMLS_CC, "s", &input, &input_len) ==
FAILURE)
return;
workstr = (char*) emalloc(input_len + 1);
memset(workstr, 0, input_len + 1);
for(index=0; index < input_len; index++)
{
workstr[index] = input[input_len - (index + 1)];
}
RETVAL_STRING( workstr, 1 );
efree( workstr );
}
char* ig_parseString(char* input);
char* ig_parseString(char* input)
{
char* replace = "Im parsed into source code";
char* output;
//char* find;
int j=0, i=0, k=0, f=0, c=0;
int replaceLenght;
replaceLenght = strlen(replace);
output = (char*) emalloc(strlen(input) + strlen(replace) + 1);
memset(output, 0, strlen(input) + strlen(replace) + 1);
/find = (char) emalloc(strlen(find) + 1);
memset(find, 0, strlen(find) + 1);*/
int lenght;
lenght = strlen(input) + strlen(replace);
for(c; c < lenght; c++){
if(input[i] == '\0')
break;//very important line. get 2H of my best time!!!--->[if remove this
line, extension fall on unlimited loop on second run]
output[j] = input[i];
i++;j++;
if(input[i] == '#' && input[++i] == '#')
{//k--;
for(k; k < replaceLenght; k++)
{
if(replace[k] == '\0'){
break;//very important
}
output[j] = replace[k];
j++;
//}
}
k=1;
do{
i++;
if(input[i] == '\0')
break;
}while(input[i] != '#');
i++;
output[j] = input[i];
j++;i++;
}
}
return output;
efree(output);
}
PHP_FUNCTION(ig_parseString)
{
char* input;
int argc = ZEND_NUM_ARGS();
int input_len;
if(zend_parse_parameters(argc TSRMLS_CC, "s", &input, &input_len) ==
FAILURE)
return;
if(ZEND_NUM_ARGS() != 1) WRONG_PARAM_COUNT;
RETURN_STRING(ig_parseString(input), 1);
efree(input);
}
PHP_FUNCTION(ig_connect_to_database)
{
zval fname, *args[3], dbLink;
zval selectDB, *args_selectDB[1], retval;
long selectDB_status;
ZVAL_STRING(&fname, "mysql_connect", 0);
MAKE_STD_ZVAL(args[0]);
ZVAL_STRING(args[0], "localhost", 1);
MAKE_STD_ZVAL(args[1]);
ZVAL_STRING(args[1], "root", 1);
MAKE_STD_ZVAL(args[2]);
ZVAL_STRING(args[2], "", 1);
if (call_user_function(EG(function_table), NULL, &fname, &dbLink, 3, args
TSRMLS_CC) == FAILURE) {
RETURN_STRING("fail to connect to database", 1);
}
else
{
zval_ptr_dtor(&args[2]);
zval_ptr_dtor(&args[1]);
zval_ptr_dtor(&args[0]);
/now! I want to select a database on success/
ZVAL_STRING(&selectDB, "mysql_select_db", 0);
MAKE_STD_ZVAL(args_selectDB[0]);
ZVAL_STRING(args_selectDB[0], "clickbartarir", 1);
if (call_user_function(EG(function_table), NULL, &selectDB, &retval, 1,
args_selectDB TSRMLS_CC) == SUCCESS)
{
/* I successfully selected database */
convert_to_long(&retval);
selectDB_status = Z_LVAL(retval);
if(selectDB_status == 1)
{
/now! I want to exceute query!/
zval query, *args_query[1], query_resource;
ZVAL_STRING(&query, "mysql_query", 0);
MAKE_STD_ZVAL(args_query[0]);
ZVAL_STRING(args_query[0], "SELECT * FROM memberplans WHERE userID = 3", 1);
if (call_user_function(EG(function_table), NULL, &query, &query_resource,
1, args_query TSRMLS_CC) == SUCCESS)
{
int resource;
resource = Z_RESVAL(query_resource);
if(resource == 0)
{
zend_error(E_ERROR, "wrong query!");
}
zval_ptr_dtor(&args_query[0]);
/now! query syntax is ok, I will do fetching.../
zval fetch_query, *args_fetch_query[1], fetch_query_resource;
ZVAL_STRING(&fetch_query, "mysql_fetch_assoc", 0);
MAKE_STD_ZVAL(args_fetch_query[0]);
ZVAL_RESOURCE(args_fetch_query[0], resource);
if (call_user_function(EG(function_table), NULL, &fetch_query,
&fetch_query_resource, 1, args_fetch_query TSRMLS_CC) == SUCCESS)
{
*return_value = fetch_query_resource;
}
}
else
{
zval_ptr_dtor(&args_query[0]);
zend_error(E_ERROR, "wrong mysql query!");
}
zval_ptr_dtor(&args_query[0]);
}
else
{
zend_error(E_ERROR, "failed to select database!");
}
zval_ptr_dtor(&args_selectDB[0]);
}
else
{
zend_error(E_ERROR, "database problem");
zval_ptr_dtor(&args_selectDB[0]);
}
}
}
PHP_FUNCTION(get_global_server_variable)
{
// This code makes sure $_SERVER has been initialized
if (!zend_hash_exists(&EG(symbol_table), "_SERVER", 8)) {
zend_auto_global* auto_global;
if (zend_hash_find(CG(auto_globals), "_SERVER", 8, (void **)&auto_global)
!= FAILURE) {
auto_global->armed = auto_global->auto_global_callback(auto_global->name,
auto_global->name_len TSRMLS_CC);
}
}
// This fetches $_SERVER['PHP_SELF']
zval** arr;
char* script_name;
if (zend_hash_find(&EG(symbol_table), "_SERVER", 8, (void**)&arr) !=
FAILURE) {
HashTable* ht = Z_ARRVAL_P(arr);
zval* val;
if (zend_hash_find(ht, "PHP_SELF", 9, (void**)&val) != FAILURE) {
script_name = Z_STRVAL_PP(val);
}
}
}
when I removed last two functions, it compiled successfully.
my full error:
1>php_my_function.obj : error LNK2001: unresolved external symbol
__imp__executor_globals_id
1>php_my_function.obj : error LNK2001: unresolved external symbol
__imp__compiler_globals_id
1>C:\Users\user\Documents\Visual Studio
2008\Projects\php_IG\Release\php_my_function.dll : fatal error LNK1120: 2
unresolved externals
hi,
I did it but have error still
note: I compile none thread safe and got error when using some user
function
in my c++ code.Not sure what you do in your code but this is typically the error
while trying to link/build TS objects while working with a NTS
configuration.Does it happen in PHP or in your ext? Please show the full error message.
Cheers,
Pierre
@pierrejoye | http://blog.thepimp.net | http://www.libgd.org
Not sure what you do in your code but this is typically the error
while trying to link/build TS objects while working with a NTS
configuration.
I just going do build NTS object (zts=0)
anything else i have to do for NST?
hi,
I did it but have error still
note: I compile none thread safe and got error when using some user
function
in my c++ code.Not sure what you do in your code but this is typically the error
while trying to link/build TS objects while working with a NTS
configuration.Does it happen in PHP or in your ext? Please show the full error message.
Cheers,
Pierre
@pierrejoye | http://blog.thepimp.net | http://www.libgd.org
Yes,use config.w32 only to avoid wasting time :)
Not sure what you do in your code but this is typically the error
while trying to link/build TS objects while working with a NTS
configuration.I just going do build NTS object (zts=0)
anything else i have to do for NST?hi,
I did it but have error still
note: I compile none thread safe and got error when using some user
function
in my c++ code.Not sure what you do in your code but this is typically the error
while trying to link/build TS objects while working with a NTS
configuration.Does it happen in PHP or in your ext? Please show the full error message.
Cheers,
Pierre
@pierrejoye | http://blog.thepimp.net | http://www.libgd.org
I hope you help me to solve this problem.
Exactly I don't underestand what should I do!
I have config.w32.h in. ..main/ folder. so, what you mean?
Yes,use config.w32 only to avoid wasting time :)
Not sure what you do in your code but this is typically the error
while trying to link/build TS objects while working with a NTS
configuration.I just going do build NTS object (zts=0)
anything else i have to do for NST?On Sat, Dec 15, 2012 at 1:33 PM, Pierre Joye pierre.php@gmail.comwrote:
hi,
I did it but have error still
note: I compile none thread safe and got error when using some user
function
in my c++ code.Not sure what you do in your code but this is typically the error
while trying to link/build TS objects while working with a NTS
configuration.Does it happen in PHP or in your ext? Please show the full error message.
Cheers,
Pierre
@pierrejoye | http://blog.thepimp.net | http://www.libgd.org
I mean to create a config.w32 file, see other extension for some examples.
I hope you help me to solve this problem.
Exactly I don't underestand what should I do!I have config.w32.h in. ..main/ folder. so, what you mean?
Yes,use config.w32 only to avoid wasting time :)
Not sure what you do in your code but this is typically the error
while trying to link/build TS objects while working with a NTS
configuration.I just going do build NTS object (zts=0)
anything else i have to do for NST?On Sat, Dec 15, 2012 at 1:33 PM, Pierre Joye pierre.php@gmail.com
wrote:hi,
I did it but have error still
note: I compile none thread safe and got error when using some user
function
in my c++ code.Not sure what you do in your code but this is typically the error
while trying to link/build TS objects while working with a NTS
configuration.Does it happen in PHP or in your ext? Please show the full error
message.Cheers,
Pierre
@pierrejoye | http://blog.thepimp.net | http://www.libgd.org
--
Pierre
@pierrejoye | http://blog.thepimp.net | http://www.libgd.org