Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support %nspace for PHP #69

Open
jdeniau opened this issue Aug 6, 2013 · 7 comments
Open

Support %nspace for PHP #69

jdeniau opened this issue Aug 6, 2013 · 7 comments

Comments

@jdeniau
Copy link

jdeniau commented Aug 6, 2013

Hello,

It would be quite nice if Swig could manager PHP namespaces.
Il is quite similar to the java namespacing.

Thank you !

@ojwb
Copy link
Member

ojwb commented Aug 23, 2013

This has already been raised in the SWIG SF feature request tracker: http://sourceforge.net/p/swig/feature-requests/81/

At this point, it mostly just needs somebody to implement it...

@ojwb
Copy link
Member

ojwb commented May 4, 2021

I've just merged Nihal's GSOC 2017 branch which has some commented out code for namespace support:

Source/Modules/php.cxx:    //if (nameSpace != NULL)
Source/Modules/php.cxx:      //Printf(s_oinit, "INIT_CLASS_ENTRY(internal_ce, \"%s\\\\%s\", class_%s_functions);\n", nameSpace, class_name, class_name);
Source/Modules/php.cxx-    //else
Source/Modules/php.cxx-    Printf(s_oinit, "  INIT_CLASS_ENTRY(internal_ce, \"%s%s\", class_%s_functions);\n", prefix, class_name, class_name);

It seems just specifying the class name including the namespace prefix works, as I've used that to name the classes we now use to wrap non-class pointer types with a SWIG\ namespace prefix.

So now this probably "just" needs hooking up to SWIG's %nspace mechanism.

@jdeniau
Copy link
Author

jdeniau commented May 5, 2021

To be honest I dont remember why I used swig, but thank you for the follow up on this issue ! 😲

@ojwb ojwb changed the title PHP namespace management Support %nspace for PHP Feb 17, 2022
@mnguyenpdftron
Copy link

@ojwb I'm also interested in using namespace. Now that php target file is gone when using swig 4.1, I have no clue how to have a namespace for our PHP wrapper.

@ojwb
Copy link
Member

ojwb commented Feb 18, 2022

It's probably not something I'll find time to work on for a while I'm afraid. If you want to try to implement it yourself, looks like getNSpace() is useful:

  /* Return the namespace for the class/enum - the nspace feature */
  String *getNSpace() const;

@ojwb ojwb added the C++ label May 31, 2023
@jdeniau jdeniau closed this as not planned Won't fix, can't repro, duplicate, stale Jun 13, 2024
@ojwb
Copy link
Member

ojwb commented Jun 13, 2024

I don't think closing as "not planned" is appropriate. There's not a timescale for implementing it, but it's definitely something we ought to support (the first part is true for the majority of open tickets here, the second true for quite a lot of them).

If you aren't interested in notifications, just unsubscribe from the issue.

@ojwb ojwb reopened this Jun 13, 2024
@jdeniau
Copy link
Author

jdeniau commented Jun 13, 2024

@ojwb sorry I was closing my issues of unmaintained package, I didn't checked out that swig was still under active development. Sorry 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants