note 23552 added to function.dotnet-load
| From: | Thomas dot Weidner at voxtronic dot com | Date: | Mon, 22 Jul 2002 06:12:40 +0000 |
| Subject: | note 23552 added to function.dotnet-load | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-33377@lists.php.net to get a copy of this message | ||
I`ve found an workaround to use the Microsoft.NET within PHP but without the need of compiling the
DOTNET.DLL of PHP.
At first write the functions you want to need within PHP in the Microsoft.NET Languages (I`m working
in CSharp).
Then make your FunctionsLibrary StrongNamed. Read about how to do this in the SDK-Help. (Key,
Version...)
Then you have to register your DLL in GAC.
For this you have to do REGASM /tlb:your.tlb your.dll
Then you have to do GACUTIL /if your.dll
After this your DLL will be recognised with in the whole .NET.
Now... to use your DLL within PHP you just have to use an ordinary COM Object.
$MyObj = new COM ("NameSpace.Class");
$ReturnValue = $MyObj -> MyFunction($MyParams);
$MyObj = NULL;
$MyParams could be any type. For example an Array.
I tested this with PHP 4.2.1, RDK-Framework, SDK-Frwamework, Visual Studio and SharpDevelop. You
have not to recompile PHP because you don´t need the DOTNET.DLL .
The only negative aspect within this way due to COMRestrictions is, that REF or OUT Values are not
returned. So you have only one return value.
But for an good written function this should be no great restriction.
If you have any further question dont be afraid and write to me...
Bye
Thomas
--
http://www.php.net/manual/en/function.dotnet-load.php
http://master.php.net/manage/user-notes.php?action=edit+23552
http://master.php.net/manage/user-notes.php?action=delete+23552
http://master.php.net/manage/user-notes.php?action=reject+23552