Why I am getting this error in zephir php extension development? - php-extension

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/myapp.so' - /usr/lib64/php/modules/myapp.so: undefined symbol: zend_error_noreturn in Unknown on line 0
My code (myapp.zep) is
namespace Myapp;
class Greeting
{
public static function test (string abc) {
return "test back";
}
}
The code worked when I remove the parameter
namespace Myapp;
class Greeting
{
public static function test () { //no parameter
return "test back";
}
}
When i set a parameter of method test with string abc then I got the error. But I compiled it in windows version it works fine..
My server configuration is
Centos 7.3 - 64bit
PHP 5.6.30 (cli) (built: Jan 19 2017 07:57:06)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0,
Copyright (c) 1998-2016 Zend Technologies
I am totally stack now. This compiled .so file , I have used in another same configuration server, where it work fine.

Related

Xamarin - iOS MFMailComposeViewController.CanSendMail results in 'Got a segv while executing native code'

I'm trying to send an e-mail from a Xamarin Forms app using an iOS code with DependencyInjection which looks like this:
[assembly: Xamarin.Forms.Dependency(typeof(SendMail))]
namespace SampleApp.iOS.PlatformSpecific
{
public class SendMail : ISendMail
{
public void SendMail()
{
Device.BeginInvokeOnMainThread(() =>
{
if (MFMailComposeViewController.CanSendMail) <-- crashes here
{
// my code
}
}
}
}
}
The line indicated above always crashes on a real device (but works on a simulator). The crash is the following:
=================================================================
Native Crash Reporting
=================================================================
Got a segv while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
Any ideas what could be wrong?

How to Reference .Net Core Library in a .Net Core Console Application

I am following this code example
I am on Visual Studio Community 2019 for Mac. I created a .Net Core - Class Library project and compiled to create the assembly file P1-ProgramStructure.dll.
I created another solution with program2.cs code. Please see the code below.
I renamed the .dll to acme.dll and copied the file into its directory.
Class library - .Net Core Project
Program1.cs
using System;
namespace Acme.Collections
{
public class Stack
{
Entry top;
public void Push(object data)
{
top = new Entry(top, data);
}
public object Pop()
{
if (top == null)
{
throw new InvalidOperationException();
}
object result = top.data;
top = top.next;
return result;
}
class Entry
{
public Entry next;
public object data;
public Entry(Entry next, object data)
{
this.next = next;
this.data = data;
}
}
}
}
.Net Core Console App
Program2.cs
using System;
using Acme.Collections;
class Example
{
static void Main()
{
Stack s = new Stack();
s.Push(1);
s.Push(10);
s.Push(100);
Console.WriteLine(s.Pop());
Console.WriteLine(s.Pop());
Console.WriteLine(s.Pop());
}
}
When I run the project, I get the error:
$ dotnet run
Program.cs(15,7): error CS0246: The type or namespace name 'Acme' could not be found (are you missing a using directive or an assembly reference?) [/Users/csarami/VisStudioProjects/cSharp Projects/Project2-ProjectStructure/Project2-ProjectStructure/Project2-ProjectStructure.csproj]
The build failed. Please fix the build errors and run again.
Make sure both projects have the same target framework

Compile C# on OSX using edge.js nuget package

So, I have this code from the edge.js instructions:
using System;
using System.Threading.Tasks;
using EdgeJs;
class Program
{
public static async void Start()
{
var func = Edge.Func(#"
return function (data, callback) {
callback(null, 'Node.js welcomes ' + data);
}
");
Console.WriteLine(await func(".NET"));
}
static void Main(string[] args)
{
Task.Run((Action)Start).Wait();
}
}
And I have nuget working so that I have installed edge.js with nuget install edge.js -o ./packages
But I can't figure out how to compile it on my Mac OSX. I've tried:
mcs -pkg:./packages program.cs
mcs -lib:./packages/Edgejs.0.10.0 program.cs
and a bunch other combinations. I always get this error:
error CS0246: The type or namespace name `EdgeJs' could not be found. Are you missing an assembly reference?
I have not tried monoDevelop yet. I'm hoping to get it to work with the mono command line tools so I don't need monoDevelop.
You can use -r to reference the Edgejs assembly.
mcs -r:./packages/Edge.js.0.10.0/lib/Edgejs.dll program.cs

Cake 2.0 CLI mode error "Undefined HTTP_HOST "

I am Running a shell script on cake console. Able to run HelloShell But getting error undefined HTTP_host on app/config/core.php for following code:
class HelloShell extends AppShell {
public $uses=array('Test');
public function main() {
$this->out('Hello Kundan.');
}
public function hey() {
$this->Test->save($data['Test']['name']='Kundan');
}
}
bellow the error message:
PHP notice: undefined index HTTP_HOST in
C:\wamp\www\myapplication\app\Config\core.php on line 231.
When I opened that file I found following on line number 231 Configure::write('Website_root',$_SERVER['HTTP_HOST']);
I have replicate your code, and it run well.
where do you put HelloShell.php file? and how do you run your code?.
The common way, put your HelloShell.php file in app/Console/Command/ directory and run it by Console/cake hello
also try to modify your code:
class HelloShell extends AppShell {
public $uses=array('Test');
public function main() {
$this->out('Hello Kundan.');
$this->hey();
}
public function hey() {
$data['Test']['name']='Kundan';
$this->Test->save($data);
}
}

Visual studio 2010 compilation issue

I have a project in Visual Studio 2010 with target to framework 3.5 with some code like this:
public class Test {
private object _field;
private Action defaultAction = null;
public Test(Action a)
{
defaultAction = a;
}
public Test()
: this(() => { _field = new object(); })
{
}
}
When I compile the project from the VS reports a compile error at line 11.
When I compile the project from the command line with "C:\Windows\Microsoft.NET\Framework\v3.5\msbuild.exe Test.sln" compiles successfully.
In fact this code compiles in VS2008 but in VS2010 with target to framework 3.5, doesn't.
Any idea about what is happend?
Update
To fix the code in V2010 I changed as follows (this is equivalent to origian code):
public class Test {
private object _field;
private Action defaultAction = null;
public Test(Action a)
{
defaultAction = a;
}
public Test()
{
defaultAction = () => {_field = new object();}
}
}
But what worries me is that Visual Studio is compiling my code with framework 4.0 and this may cause other errors when deploying my application in the customer's environment (framework 3.5).
I don't have access to VS2008 or .NET 3.5 at the moment so I can't investigate why it's compiling for you. There might be an explanation linked from What's New in the .NET Framework 4
What I can offer however is a fix to get it compiling in VS2010. By declaring _field as static, an instance of it will be available in the constructor of the Test class.
Replace the second line of your posted code with this and the code should compile:
private static object _field;

Resources