#writing vec3 stuff in c++ and calling it from a DLL

1 messages · Page 1 of 1 (latest)

cedar hollow
#

this is (probably) not that important as it would have been 5 years ago since gmrt is on the horizon and likely to shake all of this up anyway, but i did some little experiments with putting a bunch of Vector3 stuff in a dll and the results are surprising enough that i feel like there might be something wrong with the tests

the c++ isn't all that interesting

struct Vector3 {
    float x, y, z;
};

dllex double v3_add(const Vector3* a, const Vector3* b, Vector3* out) {
    out->x = a->x + b->x;
    out->y = a->y + b->y;
    out->z = a->z + b->z;
    return 1.0;
}```
so the difference has to be overhead of calling the function for some reason, right?
cedar hollow
#

also at the same time, doing "vector dot product" is more in line with what i expected to see

#

also it's the same in vm and yyc

#

oh you know what wait

#

i think my dll was compiled with some debug stuff

#

yup if i remove the debug stuff it's in line with what i expected

cedar hollow
#

this, however, is really bizarre

#

oh my god i know exactly what's going on

#

the internal list used to keep track of buffers grows like array_push instead of like ds_list_add

#

it seems to work like this for all data structures

#

anyway i'm not sure if it's worth pursuing this or not, with gmrt on the horizon and having to destroy a vec3 every time you create one being a bit of a pain