Hi,

>> id3lib is a C++ library.  I would like to create PHP objects to directly
>> interface to the C++ classes within the library.  I found the PHP docs about
>> developing extensions to be very sparse, and directed mainly for PHP 3.  Is
>> there anywhere which has proper docs dealing with PHP 4?  I've found the API
>> docs at Zend, but there doesn't seem to be a way of downloading them (this
>> is a requirement for me).
> 
> I currently have a .zip with the Zend docs at my site, you can get it from
> there:
> 
> http://docs.2good.nu/tmp/zend.zip

I'd love to get them, but the URL required a user name & password.  Maybe
you should move the file somewhere else?

>> This library being C++, does its own memory allocation.  Should I worry and
>> try to write operator new() and operator delete() replacements and
>> static-link the library, or just not bother and use the library as is?
> 
> I believe you just use the existing new and delete operators, just make
> sure you don't leak memory. Let's hear what others say on php-dev.

That's good to hear.

>> Another thing is garbage collection.  How can I get PHP to tell me to free
>> the memory dealing with my objects when they get cleaned up?  Do I need to
>> record all allocations and free things in my PHP_RSHUTDOWN function?
> 
> This is a good question. :-)
> 
> I think I have solved this by having a pointer to the C++ class instance
> stored as a resource connected to the PHP object and then deleting the C++
> class instance on resource destruction.
> 
> I looked at the COM extension to find out this. Hopefully you'll get more
> info on php-dev.

I found out about resources, and am using those at the moment.  I haven't
thought about attaching those to objects yet.  Thanks for the idea.  How
exactly do I go about that though?  I guess I'll peek at the COM extension
as well.

>> Not only is this my first PHP extension, but it is also my first proper
>> Linux project.  I've been programming C/C++ on Mac for a good few years, and
>> programming PHP for over a year now.  I know roughly how the build process
>> works, but I'm sure there are more things I should know.  Does anyone have
>> suggestions on books to buy that would cover programming non-GUI programs
>> and libraries, and the build process (building configure scripts and
>> Makefiles)?
> 
> For learning automake/autoconf I suggest you download this too from my
> site:
> 
> http://docs.2good.nu/tmp/autobook-1.0.tar.gz

Same as above, password.

> And of course you should get the make/automake/autoconf references from
> gnu.org.

Got those.  I need some time to read them now.  ;-)

> About your question about undefined symbols I know I have had the same
> problem, but I cannot recall the solution at the moment, sorry.

I found out from the MySQL extension how to do that.  You need to do some
stuff with the [extname]_SHARED_LIBADD variable.  I'm not quite sure if
that's just dynamically linking the library, of if it gets statically
linked.

> I could also try to answer any other questions you might have about PHP
> extension development in C++.
> 
> Currently I am writing an extension called Universe. This extension is a
> PHP interface to MICO (a C++ CORBA ORB). It will replace my earlier
> Satellite extension which uses ORBit (a C ORB).

Sounds interesting.  I haven't taken the time to learn CORBA, and I don't
even know what it's used for.  Maybe you could clear me up?

> Universe includes a "framework" for easy creation of PHP classes in C++
> but it's quite specialized for my needs.

I'm hoping to make my ID3 extension simple enough not to require such a
framework, but I might supply a few classes as examples and to simplify the
mid-level interface to a much higher level.

> By the way, have you thought about thread safety...? That's not easy
> either...

Supposedly id3lib is thread-safe.  I haven't tested this though.  All I'm
doing is calling id3lib and doing a few basic conversions.  One things that
worries me is the resources.  Does the Zend engine do its own locking when
you add things to resources?

Thanks for the help,

PS: I took this back onto PHP-DEV, I hope you don't mind.

-- 
    .-.         Chris Boot
    /v\      [EMAIL PROTECTED]
   // \\
  /(   )\    L   I   N   U   X
   ^^-^^    >Phear the Penguin<


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to