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

Prepend package when available to cpp methods #3

Closed
wants to merge 1 commit into from

Conversation

CircuitCipher
Copy link

I ran into an issue with HypRate that the methods would not be found on iOS because the namespace/package name was not prepended to the primitive name.

I have added logic to add the package and an underscore to the primitive name if the package is not null or empty string.

See hyperfiction/HypRate#2 for the code that will require these changes.

@shoebox
Copy link
Owner

shoebox commented Oct 10, 2013

Hi !
Why did you need to prehend the package in the primitive while the package is already used by the lib.load method ? Is it just to avoid primitive name collisions ?

The method name as primitive name make more sense to me ( same behavior than android ).

It's more flexible, and if someone does not wish ( or can not ) use the same primitive naming convention ( [package]_[primitivename] ) it still works.

Thanks !

@CircuitCipher
Copy link
Author

I will have to look at this later. I added this code because without it, HypRate would not work.

Maybe there is a way around it that can be changed in HypRate. When I get back I will send the errors that occur but basically the methods are not found without prepending the package name here even though the methods are not named that way in HypRate.

@CircuitCipher
Copy link
Author

Actually, I took a quick look and the External
Interface file does define the methods this way: https://github.com/hyperfiction/HypRate/blob/master/project/common/ExternalInterface.cpp

Also, see Joshua Granicks nme example extension sample: http://www.joshuagranick.com/blog/2012/03/20/how-to-create-an-nme-extension/

It has a similar setup and he had to provide the package name prepended to lib.

So maybe the change to make is to remove the package name in the ExternalInterface if that will still work. Then this PR may not be needed?

@shoebox
Copy link
Owner

shoebox commented Oct 10, 2013

Have you notice than there is two arguments who can be added to the "@cpp" tag ?

The first is the library name, the second the primitive name ( optional )

Take a look at this class by example :
https://github.com/hyperfiction/HypPhoton/blob/master/src/fr/hyperfiction/HypPhoton.hx

shoe[box] //

@CircuitCipher
Copy link
Author

Oh that might work. I will try those arguments out tonight. Thanks for your help.

@CircuitCipher
Copy link
Author

You're suggestion to use the library name and primitive name arguments of @cpp worked. This PR is no longer needed.

Thanks again!

@CircuitCipher CircuitCipher deleted the fix-cpp-package branch October 11, 2013 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants