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

Automatically generated exports passed to -flto-api not working #36

Open
DarioAhdoot opened this issue Dec 17, 2013 · 1 comment
Open

Comments

@DarioAhdoot
Copy link

We're having problems with our automatically generated exports.txt file. We are producing the file dynamically exactly as outlined here:

http://www.adobe.com/devnet/games/articles/using-cplusplus-code-path-finding.html

The problem is that the nm command (and grep/sed/awk commands) emits C symbols with a preceding underscore. e.g. a global variable named "foo" shows up in the exports file as "_foo". When we try and access foo from action script like so:

var foo:int = CModule.read32(CModule.getPublicSymbol("foo"))

we get an exception of this sort:

ReferenceError: Error #1065: Variable _foo is not defined.
    at com.adobe.flascc::CModule$/getPublicSymbol()
    at com.adobe.flascc::Console/enterFrame()

If we manually remove the underscore from _foo in the exports.txt file, the issue goes away.

In Alex Mac's OpenCV example, he includes a statically generated exports.txt file which references a global variable called "imageData". The exports.txt file contains "imageData" not "_imageData". If we run the nm/grep/sed/awk command on his OpenCV faceTracker.cpp file, the exports.txt generated has "_imageData" and his face tracker demo fails to work.

Any idea what we should be doing here?

@cbakgly
Copy link
Contributor

cbakgly commented Dec 29, 2013

If I don't remember wrong...
The way in future branch is different with master branch.
In future branch, symbols are processed normally like native way. Means that normal external symbols prefix '' except builtin atomic ops.
In master branch, symbols are remaining untouched. So have to manually prefix '
' to accommodate external symbols lookup.

So it's mixing since in AS there is no external symbol prefixing or name mangling, but when you access symbols which come from C/C++, should make a symbol wrapping.
Hope this is correct and clear.

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

No branches or pull requests

2 participants