Skip to content

new example native activity #48

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

Closed
wants to merge 2 commits into from

Conversation

ousttrue
Copy link

I tried a simple example using android_main.

I want to use vulkan and openxr on android with zig.
Thank you.

extern "C" {

void call_souce_process(android_app *state, android_poll_source *s) {
s->process(state, s);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can not call c++ member function from zig.


const float* get_acceleration(const ASensorEvent *event)
{
return &event->acceleration.x;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can not use anonymous union ?

typedef struct ASensorEvent {
    int32_t version; /* sizeof(struct ASensorEvent) */
    int32_t sensor;
    int32_t type;
    int32_t reserved0;
    int64_t timestamp;
    union {
        float           data[16];
        ASensorVector   vector;
        ASensorVector   acceleration;
        ASensorVector   magnetic;
        float           temperature;
        float           distance;
        float           light;
        float           pressure;
    };
    int32_t reserved1[4];
} ASensorEvent;

@@ -0,0 +1,10 @@
pub usingnamespace @cImport({
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should avoid pub usingnamespace as it's proposed to be removed for legitimate reasons.
CTranslateModule should be using for this kind of thing instead.

Related issue:
ziglang/zig#20663

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see 👀

@silbinarywolf
Copy link
Owner

This is not an example I'm willing to merge in and/or maintain. The value of this is unclear.

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