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

missing runtime methods for allocating arrays #105

Open
ahicks92 opened this issue May 11, 2019 · 4 comments
Open

missing runtime methods for allocating arrays #105

ahicks92 opened this issue May 11, 2019 · 4 comments

Comments

@ahicks92
Copy link

based off the helpers and the Emscripten docs, there needs to be a Box2D.allocate, Box2D.getValue, and Box2D.setValue, possibly others. Using the asm.js build these don't seem to exist anymore. This might be because I'm doing something very wrong, or because Emscripten now wants you to specify runtime methods to export (specifically that doc implies that they can get optimized out if you don't).

At the moment I can move forward without this functionality. I don't know enough about Emscripten to fix this trivially, but I'll come back to it if/when I get blocked, if it's still open.

@ahicks92
Copy link
Author

Also if these are missing, are there other things from the preamble that we should be exporting? Might be best to check them all at once.

@kripken
Copy link
Owner

kripken commented May 13, 2019

Yeah, emscripten now requires explicit exporting of runtime methods. We should add any of those that are mentioned in the docs as working, I guess.

Do we mention allocate, though? That's an internal API I hope isn't used outside of core emscripten code.

And getValue/setValue are kind of slow - may be better to document using Box2D.HEAPF32 or such.

@ahicks92
Copy link
Author

They're used in the helpers, for building chain and polygon shapes. Here.

I guess it's more of an Emscripten issue, but if there's another way to allocate arrays it's not documented well. I guess it could export C's malloc.

@kripken
Copy link
Owner

kripken commented May 15, 2019

I see, thanks. Yeah, malloc would be a much better option to use here (faster too).

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