473,480 Members | 2,592 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Coding PHP extensions

19 New Member
I am following "Extending and Embedding PHP" by Sara Golemon. While explaining the concepts she has used several small snippets of code as such

Expand|Select|Wrap|Line Numbers
  1.  
  2. void describe_zval(zval *foo)
  3. {
  4.     if (Z_TYPE_P(foo) == IS_NULL) {
  5.         php_printf("The variable is NULL");
  6.     } else {
  7.         php_printf("The variable is of type %d",
  8.                             Z_TYPE_P(foo));
  9.     }
  10. }
  11.  
  12.  
I tried writing the code in a .c file. But i am at loss regarding the dependencies required to compile the code.
Please guide.
Mar 13 '13 #1
2 1204
weaknessforcats
9,208 Recognized Expert Moderator Expert
The quickest thing here is to research how a C/C++ program is built.

Each .c file is compiled separately into a .obj file. Things like Z_TYPE and IS_NULL have to be declared before you can use them. You will need to #include a header file with those declarations.

Then each .obj file is copied to the .exe file and missing definitions must be resolved. The actual code for things like Z_TYPE must be in another .obj file or in a library.

This whole process is cotained in a file called a makefile.

The steps to do this should be part of your IDE.
Mar 13 '13 #2
suvarna271
19 New Member
Thanks @weaknessforcats. Actually i was confused regarding the location of the macros Z_TYPE etc . Those are Zend variables and using phpize, just like its done for PHP extension development does the trick.
Mar 14 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

27
4585
by: gmtonyhoyt | last post by:
I need assistance coming up with a clean way to handle filename extensions with my application. While I can come up with several ways of doing so on my own, I felt perhaps it would be worth...
1
1684
by: R Reyes | last post by:
Hello All, I'm always looking for ways to improve my code. Most of the time (whenever I'm working on a project) I write a bunch of functions. Then after the project is finished, I put all the...
3
7467
by: Chris Paul | last post by:
I'm having trouble with PHP & PostgreSQL/OpenLDAP/Apache on Windows. I've set this up countless times on BSD (piece of cake) but I'm trying to do this on Windows now so that my developer can work...
10
2506
by: musosdev | last post by:
Hi guys I'm trying to migrate to VS2005... I've managed to do that, but realised I'd opened my web projects as file projects, and I'm getting the error about network BIOS command limit. ...
17
1426
by: Domestos | last post by:
Hi all, I was wondering if there is a standard when mixing PHP and HTML script on a page... and if there were any articles on this subject... i.e. do I make every page a .php page on my...
59
4145
by: Anando | last post by:
Hi, I have a linear singly linked list of 100 elements. I would like to prune it such that only user specified elements (say only the elements 1, 13, 78 and 100 of the original list) survive...
52
2929
by: Sergey Zuyev | last post by:
Hello All I work at software company and we are having a really big discussion about coding styles and it seems that more people prefer statement 1 to statement2 , which was a big surprise to...
2
1411
by: John Nagle | last post by:
I hadn't read this before, but I just came back from the Embedded Systems Conference, where three vendors were selling checking tools to find bugs in real-time C code. Sometimes they can detect...
1
2508
by: Yan | last post by:
Hi, I'm apparently far from being the 1st one to meet this error... My asp.net ajax page requires ScriptManager.axd but gets a 404. following a lot of "This is how I solved it" posts, I : -...
0
7055
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6920
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7060
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6760
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5365
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4501
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1311
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.