Compiler Error Message: CS1501

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

Compiler Error Message: CS1501

Postby bholbrook@codeplex » November 17th, 2006, 12:08 am

I keep getting this compile error and I dont understand why.

Compiler Error Message: CS1501: No overload for method 'johnny' takes '0' arguments

--------------------------
web.config (small section)
--------------------------
<sessionState timeout="10"/>
<compilation debug="true">
<assemblies>
<add assembly="PhpNetCore, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0a8e8c4c76728c71"/>
</assemblies>
</compilation>

-----------------
App_Code/core.php
-----------------

<?

import namespace System;
import namespace System:::Data;
import namespace System:::Web;
import namespace System:::Web:::UI;

namespace hciPHP
{
class johnny
{

private $strName;

public function __construct()
{
$this->strName = 'mysql';
}

public function getDbaName()
{
return $this->strName;
}
}
}

?>

------------
Default.aspx
------------

<%@ Page Language="C#" %>
<%@ Import Namespace="hciPHP" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script language="C#" runat="server">

void Page_Load()
{

johnny objJohnny = new johnny();
string strDbaName = objJohnny.getDbaName();
Response.Write(strDbaName);

}

</script>
bholbrook@codeplex
 
Posts: 1
Joined: January 7th, 2012, 8:57 pm

RE: Compiler Error Message: CS1501

Postby tomasp » November 18th, 2006, 10:07 pm

Hi bholbrook,
Using C# as a language for writing ASP.NET pages and PHP as a language (or one of languages) used in App_Code is very interesting idea! I quite like it, because it allows people to use classes written in PHP together with new ASP.NET 2.0 projects. Just wondering, is this your case?

Ok, let's get back to your question :-). If you want to use class written in PHP from another language you should mark it with Export attribute like this:

Export
class johnny
{
// ..
}

This makes Phalanger to add overloads that are easilly accessible from "standard" .NET languages. You'll also need to modify the code that uses the class a little (added one type cast):

hciPHP.johnny objJohnny = new hciPHP.johnny();
string strDbaName = (string)objJohnny.getDbaName();
Response.Write(strDbaName);


If you'll have any other troubles, let us know, this is very interestng scenario!

Tomas
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 36 guests

User Control Panel

Login

Who is online

In total there are 36 users online :: 0 registered, 0 hidden and 36 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 36 guests