Call a self-created dll in php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Ares82
Forum Newbie
Posts: 2
Joined: Wed Sep 29, 2010 8:21 am

Call a self-created dll in php

Post by Ares82 »

Hello everyone,
could you please explain how to load a dll (created in C++) into a php script? Before creating this post, I spent two days googling and I only found that maybe you have to use dl function, or maybe COM function or something else, but I did not find anything useful, because there was nowhere a detailed procedure to follow in order to do that...

Thank you very much!
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Call a self-created dll in php

Post by Weirdan »

There's one sure way to use an external library - write a PHP extension to provide php interface to the library. There's plenty of information around the net on writing extensions.
Ares82
Forum Newbie
Posts: 2
Joined: Wed Sep 29, 2010 8:21 am

Re: Call a self-created dll in php

Post by Ares82 »

Thank you Weirdan. Unfortunately, however, after a check on the Internet, I believe that if I use an extension I would have to rewrite the dll: this is not possibile, because that library (containing mathematical routines) is currently used at the same time by C++, Matlab and R routines, and for this reason is not changeable. I am confident that a so constructed dll (readable by C++, R and Matlab) is readable (as it is) even by PHP, but I don't know how...
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Call a self-created dll in php

Post by requinix »

Ares82 wrote:currently used at the same time by C++
PHP extensions are written in C. If you can get C++ code to use your library then you can get C to use it as well.
Post Reply