ebitengine / purego

Apache License 2.0
1.95k stars 63 forks source link

Support returning struct #195

Closed TotallyGamerJet closed 4 months ago

TotallyGamerJet commented 5 months ago

Similar to #88 but about returning structs.

shehackedyou commented 5 months ago

I believe this can currently be done by wrapping the struct with a function that returns that type of struct; but I agree, this would be useful.

I have a list of programs I want to update once I understand this library better.

pushkarmoi commented 4 months ago

@shehackedyou @TotallyGamerJet is there a way to achieve this? Any code sample would be very helpful. Lets say i want to use the following C function definition -

typedef struct BytesBuffer {
  int32_t length;
  uint8_t *start;
} BytesBuffer;

struct BytesBuffer get_field_value(int64_t handle, char *key, int32_t key_len);
TotallyGamerJet commented 4 months ago

@shehackedyou @TotallyGamerJet is there a way to achieve this? Any code sample would be very helpful.

It can be done but it's not yet implemented in purego which is the reason for this issue.