Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8523517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:25:53+00:00 2026-06-11T07:25:53+00:00

I have a serious problem with calling references in my php code. I wrapped

  • 0

I have a serious problem with calling references in my php code. I wrapped my c++ class with swig and want to call the method, after I read the manual I figured out that, in SWIG when there is a reference in c++ arguments we have:

class foo {
Public;
double bar(double &a);
}

in swig wrapper class we have:

double foo_bar(foo *obj,double *a) {
obj->bar(*a);}

I totally understand that, my question is how can I call the method bar in PHP code?
I started with:

$ptr_a = &$a
$obj->bar($ptr_a);

but it doesn’t work. Any idea???

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T07:25:54+00:00Added an answer on June 11, 2026 at 7:25 am

    I had a go with using phppointers.i and the REF typemap to create something that used the PHP concept of a reference. I couldn’t get that to work, but the standard, language neutral SWIG approach to handling things like this with cpointer.i worked just fine:

    %module test
    
    %include <cpointer.i>
    
    %pointer_class(double,Double);
    
    %inline %{
      void func(double& a) {
        a = -666.0;
      }
    %}
    

    Worked as expected with:

    <?php
    include('test.php');
    echo "testing\n";
    $a=new Double(0.0);
    test::func($a);
    echo "In PHP: " . $a->value() . "\n";
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok guys, I have a serious problem with this. I have a static class
I have a serious problem with getting data from a sql query in php
I have a serious problem in my iphone application. It gets closed after entering
I have encountered a slightly unusual problem. Consider the following code: class parser {
I have a serious problem. Every time I edit my source code, I have
I have some serious problem dealing with files in php with utf-8 encoding. I
i have very serious problem if any tech expert can help...thank you in advance..
I have a serious problem. One of our servers crashed. Now I reinstalled the
I am new to python and I have a serious problem that I cannot
I am writing ESME using logica smpp lib , but have a serious problem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.