Compilation Problems: Unable to resolve Show method at this point during compile-time
2 posts
• Page 1 of 1
Compilation Problems: Unable to resolve Show method at this point during compile-time
Hi to all,
this is my first thread here! I'm playing with phalanger trying to my application to import php files, compile them, directly in memory, instance a class and execute a method.
After some brainstorming on how phalanger create compiled assemblies (constructors, methods and so on), i understood that i need to instance an ApplicationContext and a ScriptContext to execute them. Probably something is done in a correct way but it works: my application can compile, load, instance a class and execute a method throght late binding/delegates
I decided to do something more complex: i wanna that php code show a form when the method is called from the main application.
I added import namespace System:::Windows:::Forms on the top of the php file and i referenced the assembly using the complete path. Naturally i've added the code into the method, this:
$a = new Form();
$a.Show();
When i compile it give an error line the one in the title (it isin't the same, but are really similar)
Here there is the code i tried to compile
#######CODE#######
<?php
import namespace System;
import namespace System:::Windows:::Forms;
class TestClass
{
public function __construct()
{
// do nothing
}
public function TestMethod()
{
$a = new Form();
$a.Show(); /*** compilation error here ***/
}
}
?>
#######CODE#######
Here, instead, there is the C# code that i use to compile this:
#######CODE#######
System.CodeDom.Compiler.CompilerParameters parameters = new System.CodeDom.Compiler.CompilerParameters();
parameters.IncludeDebugInformation = false;
parameters.TreatWarningsAsErrors = true;
parameters.WarningLevel = 3;
parameters.CompilerOptions = "/target:dll";
parameters.GenerateExecutable = false;
parameters.GenerateInMemory = true;
parameters.ReferencedAssemblies.Add(@"C:\Windows\assembly\GACMSIL\System.Windows.Forms\2.0.0.0_b77a5c561934e089\System.Windows.Forms.dll");
PHP.Core.CodeDom.PhpCodeProvider phpCodeProvider = new PHP.Core.CodeDom.PhpCodeProvider();
System.CodeDom.Compiler.CompilerResults results = phpCodeProvider.CompileAssemblyFromFile(parameters, new string[] { @".\test.php" });
#######CODE#######
If you try to comple with phpc command line remember to set the /pure switch and to reference the assembly or it will gave errors!
thanks for your help!
this is my first thread here! I'm playing with phalanger trying to my application to import php files, compile them, directly in memory, instance a class and execute a method.
After some brainstorming on how phalanger create compiled assemblies (constructors, methods and so on), i understood that i need to instance an ApplicationContext and a ScriptContext to execute them. Probably something is done in a correct way but it works: my application can compile, load, instance a class and execute a method throght late binding/delegates
I decided to do something more complex: i wanna that php code show a form when the method is called from the main application.
I added import namespace System:::Windows:::Forms on the top of the php file and i referenced the assembly using the complete path. Naturally i've added the code into the method, this:
$a = new Form();
$a.Show();
When i compile it give an error line the one in the title (it isin't the same, but are really similar)
Here there is the code i tried to compile
#######CODE#######
<?php
import namespace System;
import namespace System:::Windows:::Forms;
class TestClass
{
public function __construct()
{
// do nothing
}
public function TestMethod()
{
$a = new Form();
$a.Show(); /*** compilation error here ***/
}
}
?>
#######CODE#######
Here, instead, there is the C# code that i use to compile this:
#######CODE#######
System.CodeDom.Compiler.CompilerParameters parameters = new System.CodeDom.Compiler.CompilerParameters();
parameters.IncludeDebugInformation = false;
parameters.TreatWarningsAsErrors = true;
parameters.WarningLevel = 3;
parameters.CompilerOptions = "/target:dll";
parameters.GenerateExecutable = false;
parameters.GenerateInMemory = true;
parameters.ReferencedAssemblies.Add(@"C:\Windows\assembly\GACMSIL\System.Windows.Forms\2.0.0.0_b77a5c561934e089\System.Windows.Forms.dll");
PHP.Core.CodeDom.PhpCodeProvider phpCodeProvider = new PHP.Core.CodeDom.PhpCodeProvider();
System.CodeDom.Compiler.CompilerResults results = phpCodeProvider.CompileAssemblyFromFile(parameters, new string[] { @".\test.php" });
#######CODE#######
If you try to comple with phpc command line remember to set the /pure switch and to reference the assembly or it will gave errors!
thanks for your help!
- danieledll@codeplex
- Posts: 6
- Joined: January 7th, 2012, 8:52 pm
RE: Compilation Problems: Unable to resolve Show method at this point during compile-time
I've seen only now that the message didn't regards an error but a warning!
However, how i can avoid it?
Edit
yeah, i'm stupid ... php code wrong :D
However, how i can avoid it?
Edit
yeah, i'm stupid ... php code wrong :D
- danieledll@codeplex
- Posts: 6
- Joined: January 7th, 2012, 8:52 pm
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 14 guests