how to compile a .php into DLL for C# use

Discussion about the open-source Phalanger [?] project.

how to compile a .php into DLL for C# use

Postby Ganymede@codeplex » December 4th, 2006, 1:40 pm

Hi

I posted earlier about namespaces problems. what i would like to know is what are the steps to compile a .php into dll from installation to C# instantiation, i have the following:

1) installed phalanger
2) locate my .php file add namespaces and class so usuable from .net
3) used phpc using dll as output
4) reference from my c# application.
5) create object in code and use function

If that is correct i get a namespace problem...i either get <> in the namespace name or if i dont use a namespace i cant find my class from c#...

Regards

Peter
Ganymede@codeplex
 
Posts: 2
Joined: January 7th, 2012, 8:56 pm

RE: how to compile a .php into DLL for C# use

Postby tomasp » December 5th, 2006, 1:03 pm

Hi,
probably the best way to produce assembly that can be used from C# is to use the "pure" mode. This mode is more strict, but this allows us to produce better .NET compatibility. Try compiling your code using:

phpc /target:dll /pure ..files..

In addition, if you have a class in this mode which you want to use from .NET, you can mark it using export attribute like this:

Export
class A {
// ..
}

If you use export Phalanger will create overloads that can be easilly called from C#.
tomasp
 
Posts: 46
Joined: January 7th, 2012, 8:37 pm


Return to Phalanger project

Who is online

Users browsing this forum: No registered users and 7 guests

User Control Panel

Login

Who is online

In total there are 7 users online :: 0 registered, 0 hidden and 7 guests (based on users active over the past 5 minutes)
Most users ever online was 511 on April 27th, 2024, 10:11 pm

Users browsing this forum: No registered users and 7 guests