how to compile a .php into DLL for C# use
2 posts
• Page 1 of 1
how to compile a .php into DLL for C# use
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
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
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#.
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
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 7 guests