Comments (6)
I think some minor cleanup should be done in order to make it compile on windows.
Specifically, C99 constructs, maybe others.
from mjs.
i am able to compile it now, some changes here and there in headers,
but im getting read access violation, after returning from winapi's messageboxa function
code:
#include<Windows.h>
#include "mjs.h"
#include <conio.h>
void *my_dlsym(void *handle, const char *name) {
if (strcmp(name, "msg") == 0) return GetProcAddress(LoadLibraryA("user32.dll"),"MessageBoxA");
return NULL;
}
int WINAPI WinMain(HINSTANCE hInst,HINSTANCE hPrev,LPSTR cmd,int n)
{
struct mjs *mjs = mjs_create();
mjs_set_ffi_resolver(mjs, my_dlsym);
mjs_exec(mjs, "let f = ffi('int msg(int,char*,char*,int)'); f(0,'asdf','asdf',0);", NULL);
_getch();
return 0;
}
any idea?
from mjs.
FFI can work with up to 6 32-bit arguments and up to 2 64-bit arguments.
are you on 64-bit windows or on 32-bit?
Btw, which changes to headers you needed to do? dirent.h
-> direct.h
?
from mjs.
windows is 64but, binary is 32bit compiled, dont remember will post after seeing again, no this direct.h change was not one of them as i remember
from mjs.
any update? or support?
from mjs.
mJS is now friendly to vc2017, and to the old vc98 as well.
Take a look at the unit test makefile:
https://github.com/cesanta/mjs/blob/master/mjs/Makefile
It has vc98 and vc2017 targets.
Out of curiosity, could you elaborate on your use case please?
from mjs.
Related Issues (20)
- Assertion `userdata_idx > 0' failed at src/mjs_ffi.c:560: ffi_fn_t *get_cb_impl_by_signature(const mjs_ffi_sig_t *)
- Assertion `ctx->frame == NULL' failed at src/mjs_json.c:406: void frozen_cb(void *, const char *, size_t, const char *, const struct json_token *)
- SEGV src/mjs_ffi.c:456 in ffi_cb_impl_wpwwwww
- SEGV src/mjs_ffi.c:982:24 in mjs_ffi_cb_free
- SEGV src/mjs_gc.c:190:11 in gc_sweep
- SEGV
- Invalid memory read in mjs_execute() at mjs.c:9320 HOT 1
- Heap buffer overflow in mjs_mk_string() at mjs.c:13671
- Segmentation fault in mjs_exec.c:880
- stack-overflow onpnext
- stack-overflow in parse_call_dot_mem
- SEGV in exec_expr
- SEGV in mjs_parse_ffi_signature
- Function Pointer Hijack mjs/mjs.c in mjs_execute HOT 1
- SEGV in mjs_getretvalpos
- SEGV (/mjs/mjs+0x4ec508)
- SegFaultOnPc in mjs_destroy() at mjs.c:7563
- Segmentation Fault in getprop_builtin_foreign HOT 1
- stack-overflow in mjs_op_json_stringify() at mjs.c:11362
- SEGV in mjs_op_json_parse() at mjs.c:11364
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mjs.