Page 1 of 1

Call a self-created dll in php

Posted: Wed Sep 29, 2010 8:34 am
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!

Re: Call a self-created dll in php

Posted: Wed Sep 29, 2010 12:58 pm
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.

Re: Call a self-created dll in php

Posted: Thu Sep 30, 2010 6:12 am
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...

Re: Call a self-created dll in php

Posted: Thu Sep 30, 2010 6:31 am
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.