phpc compiling generates invalid namespaces
6 posts
• Page 1 of 1
phpc compiling generates invalid namespaces
Hello,
I am currently trying to integrate a PHP-Libary into my C#-MVC-Application.
When I saw that there is a php-Compiler I tried to use it doing the following command:
The Compiler is giving me some warings about unknown functions, but it succeds. The Problem is, I cannot use the DLL created since the all the Namespaces are in angle-brackets which is invalid.
Any advice what I could try?
Greetings
Neokil
I am currently trying to integrate a PHP-Libary into my C#-MVC-Application.
When I saw that there is a php-Compiler I tried to use it doing the following command:
phpc /target:dll /out:Teamspeak3.dll /recurse:TeamSpeak3 /root:.
The Compiler is giving me some warings about unknown functions, but it succeds. The Problem is, I cannot use the DLL created since the all the Namespaces are in angle-brackets which is invalid.
Any advice what I could try?
Greetings
Neokil
- Neokil
- Posts: 3
- Joined: September 8th, 2015, 11:26 am
Re: phpc compiling generates invalid namespaces
hi,
Phalanger compiler works in two modes:
- standard: PHP files are compiled as a class within 'weird' namespace. (http://wiki.php-compiler.net/Multi_Script_Assembly)
- pure: compilation similar to C# compiler - all files are compiled all together, and resulting DLL contains nice classes within their namespace. (http://wiki.php-compiler.net/Pure_mode)
Add following to your command line (or use Phalanger Tools for Visual Studio, and set compilation mode: pure in project properties):
note: wiki is slightly old, will be updated
Phalanger compiler works in two modes:
- standard: PHP files are compiled as a class within 'weird' namespace. (http://wiki.php-compiler.net/Multi_Script_Assembly)
- pure: compilation similar to C# compiler - all files are compiled all together, and resulting DLL contains nice classes within their namespace. (http://wiki.php-compiler.net/Pure_mode)
Add following to your command line (or use Phalanger Tools for Visual Studio, and set compilation mode: pure in project properties):
- Code: Select all
/pure+
note: wiki is slightly old, will be updated
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: phpc compiling generates invalid namespaces
ok, I tried that it seems "include"-Keyword is not supported.
Since I dont want to rewrite the whole library so it will not use include, I am not sure how to go from here.
Might it be better to use the ScriptingContext than trying to convert the Library into .NET?
Since I dont want to rewrite the whole library so it will not use include, I am not sure how to go from here.
Might it be better to use the ScriptingContext than trying to convert the Library into .NET?
- Neokil
- Posts: 3
- Joined: September 8th, 2015, 11:26 am
Re: phpc compiling generates invalid namespaces
right, include cant be used in 'pure' mode, since it is not needed - all the files are included by default already.
When using standard mode, Phalanger has to deal with all the php files separately, that's why it is in separate namespaces. In this way, you have to use it as shown at http://wiki.php-compiler.net/Multi_Scri ... T_language)_project
Note standard mode may have slower startup performance, since many classes have to be compiled at runtime yet
When using standard mode, Phalanger has to deal with all the php files separately, that's why it is in separate namespaces. In this way, you have to use it as shown at http://wiki.php-compiler.net/Multi_Scri ... T_language)_project
Note standard mode may have slower startup performance, since many classes have to be compiled at runtime yet
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: phpc compiling generates invalid namespaces
hmm... ok I commented out all includes and tried to recompile it.
It worked but at runtime it threw me an error that some function is missing, so I looked into the log-files a little bit closer and found the list of unknown functions which had about 250 entrys.
And when I sat down to replace all the unknown functions after about an hour I decided it would be easier to create a new framework than replacing all the unknown commands in this one.
I am not sure what scripts phalanger can compile for when I look in the list of unknown functions there are things like "strlen" and "substr" as well as "preg_match" which seem to me like some of the functions that are used quite often.
It worked but at runtime it threw me an error that some function is missing, so I looked into the log-files a little bit closer and found the list of unknown functions which had about 250 entrys.
And when I sat down to replace all the unknown functions after about an hour I decided it would be easier to create a new framework than replacing all the unknown commands in this one.
I am not sure what scripts phalanger can compile for when I look in the list of unknown functions there are things like "strlen" and "substr" as well as "preg_match" which seem to me like some of the functions that are used quite often.
- Neokil
- Posts: 3
- Joined: September 8th, 2015, 11:26 am
Re: phpc compiling generates invalid namespaces
all the functions you named are defined in PhpNetClasslibrary.dll. Just add reference to it.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 16 guests