Giter Club home page Giter Club logo

Comments (6)

cpq avatar cpq commented on May 27, 2024

I think some minor cleanup should be done in order to make it compile on windows.
Specifically, C99 constructs, maybe others.

from mjs.

0x410c avatar 0x410c commented on May 27, 2024

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.

cpq avatar cpq commented on May 27, 2024

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.

0x410c avatar 0x410c commented on May 27, 2024

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.

0x410c avatar 0x410c commented on May 27, 2024

any update? or support?

from mjs.

cpq avatar cpq commented on May 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.