I have done this... with some level of pain.  This may be overkill for some
of you, but these are the tips I wish I had when I started this.

First, I am a UNIX person, so having to do this in Windows was probably
harder for me than for the rest of you.

Since everything in PHP is a variant, it seemed to make the most sense to
accomplish this by converting my dll to a com obj (that way I got ASP, VB,
etc... for free).  For a UNIX person, this work totally sucks... but you can
use the MS IDE to do most of the work for you.  Once you do that, you can
instantiate a new com obj in the php code and call member functions.

ex.

$onthComServer=new COM("OnthDB.SessionMgr");
$iSessID = $onthComServer->CreateSession();

>From here you simply have to remember to convert the variant types to normal
C++ types in your C++ code.  The only real gotcha came when I tried to send
in vars by ref... to do this you must first declare the vars in php to be
reference vars before you use them.

ex.

iCellType=new Variant("0",VT_INT|VT_BYREF);     // for int...
sCellVal=new Variant("GonzoBreath",VT_BSTR|VT_BYREF);   // for string

Other areas of frustration come when trying to debug through to your dll
while running php.  The easiest way I have found is to use the PHP SAPI
modules (W2k and IIS with ISAPI is what I am using).  Run your app once
without debugging, and then attach your debugger to the inetinfo process,
create your breakpoints, and run again.

You can debug with CGI, but that will involve adding a wait statement /
infinite loop to your dll that will give you time to attach a debugger.

Hopefully this helps.

// Mike Eynon
// www.MikeEynon.com
// 1366 Bulb Ave
// Santa Cruz, CA  95062
// [EMAIL PROTECTED]
// 831.588.2388 (cell)




-----Original Message-----
From: Josh Seward [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 24, 2001 4:53 PM
To: Karen Siefken; [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] Dlls


I am also looking for an answer to this question. I am using the fallowing
JavaScript to call the .dll file.

<script language="JavaScript" src="http://server/Scripts/convert.dll?convert
src=C:\Inetpub\wwwroot\art\\$id.$type&dest=C:\Inetpub\wwwroot\movies\\$id">
</script>

Is there a way to call this for use in php?

I believe this is a question of the same nature.

Thanks,






----- Original Message -----
From: "Karen Siefken" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, October 24, 2001 1:05 PM
Subject: [PHP-WIN] Dlls


Can you use user defined dlls in php? If so does anyone know where I can
find info on how to create a dll to use in PHP?

K





--
PHP Windows 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]


-- 
PHP Windows 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