473,546 Members | 2,468 Online
Bytes | Software Development & Data Engineering Community
+ 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 1209
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 @weaknessforcat s. 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
4606
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 asking here to see what more effective or accepted methods for doing would be presented. The issue is this. My application accepts files names,...
1
1690
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 similar functions into their own module/class/page for neatness: -- like a stringsManipulate class which has all string manipulation methods to the...
3
7471
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 on her local machine. Everything looks pretty good. OpenLDAP/cygwin works great. PostgreSQL works great. Apache runs. PHP runs. But when I...
10
2511
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. Anyway, I decided to have a go at loading them as web projects from our Win2k3 server. It gets so far and then says "The web server does not appear to...
17
1429
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 website and echo html when I need to or... should I make every page html and embed php when I need to..
59
4181
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 after pruning. Can somebody show me how to do this ? I am a scientist and not a computer engineer/student. This will help me develop an application...
52
2949
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 me. Please help us with your comments. Thanks Which way is better way 1 or 2? 1. 'set enable status on CheckboxPrimaryYN
2
1418
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 array bounds errors by static analysis. But the approaches used aren't airtight. Reading the "CERT C Secure Coding Standard" is interesting, but...
1
2513
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 : - checked my web.config (copied below) - re-installed the ajax.net extensions - ran aspnet_regiis my application
0
7504
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7435
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7694
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7792
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5360
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5080
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3491
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1921
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 we have to send another system
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.