Hi,
Thanks for making such a state of the art work, I am using it in my 3D modeling
software to provide procedural nodes generation api.
May I suggest some of the code changes to better support visual studio please?
Before I list my suggestions, I have to say that QuickJS is very easy to embed
into C++ codebase. However I have to do many dirty works before it compiles on
visual studio, I see there is a new release, I guess I have to do it again if I
want update QuickJS to the latest version.
Here are some suggestions:
- Change the triple dots inside switch-case to normal cases
- Remove the zero length array at the beginning of JSShape structure
struct JSShape {
#if !defined(_MSC_VER)
uint32_t prop_hash_end[0]; /* hash table of size hash_mask + 1
before the start of the
structure. */
#endif
... ...
}
#if defined(_MSC_VER)
#define prop_hash_end_field_of_shape(shape) ((uint32_t *)(shape))
#else
#define prop_hash_end_field_of_shape(shape) (shape)->prop_hash_end
#endif
Replace all `sh->prop_hash_end` with `prop_hash_end_field_of_shape(sh)`
- Other c99 features, such as
Replace
#define JS_MKVAL(tag, val) (JSValue){ .u.int32 = val, tag }
With
static inline JSValue JS_MKVAL(uint64_t tag, int32_t val)
{
JSValue value = {};
value.u.int32 = val;
value.tag = tag;
return value;
}
Some informations maybe useful for testing on Windows:
- Here is the 90 days free windows for virtual machines provided by
Microsoft
https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/
- My modified quickjs-2019-07-09:
https://github.com/huxingyi/dust3d/tree/master/thirdparty/quickjs/quickjs-2019-07-09-dust3d
I made it runs on linux and native windows with many dirty fixes.
Best regards,
Jeremy.