GithubHelp home page GithubHelp logo

danielga / gm_ffi Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 1.0 79 KB

A module for Garry's Mod that adds an FFI library similar to LuaJIT's FFI.

Home Page: https://github.com/danielga/gm_ffi

License: Other

Lua 13.35% C++ 1.11% C 85.54%
garrysmod garrysmod-module gmod gmod-module garrys-mod

gm_ffi's Introduction

gm_ffi

A module for Garry's Mod that adds an FFI library similar to LuaJIT's FFI.

Compiling

The only supported compilation platform for this project on Windows is Visual Studio 2017. However, it's possible it'll work with Visual Studio 2015 and Visual Studio 2019 because of the unified runtime.

On Linux, everything should work fine as is.

For macOS, any Xcode (using the GCC compiler) version MIGHT work as long as the Mac OSX 10.7 SDK is used.

These restrictions are not random; they exist because of ABI compatibility reasons.

If stuff starts erroring or fails to work, be sure to check the correct line endings (\n and such) are present in the files for each OS.

Requirements

This project requires garrysmod_common, a framework to facilitate the creation of compilations files (Visual Studio, make, XCode, etc). Simply set the environment variable GARRYSMOD_COMMON or the premake option --gmcommon=path to the path of your local copy of garrysmod_common.

gm_ffi's People

Contributors

danielga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

raphaelit7

gm_ffi's Issues

Release

Hello, your job here looks quite promising. But I'm not quite used to low-level compilers like MSVC, in fact, I did attempt to compile things like this before but it seems quite complex for regular Lua coders.
Is there by any chance that you could provide a distribution (dll) of gm_ffi?

Getting this to run on the x86-64 branch of GMod

I don't expect you to support a branch that is officially beta, but I figured I'd ask anyway if you can suggest any more steps I can try.

So:

  • I am using the x86-64-support-sourcesdk branch of garrysmod_common
  • I edited ffi.h to rename luaL_setfuncs to luaL_setfuncsx as LuaJIT seems to declare that one now (I also changed references in ffi.c, removing the extraneous definition flat-out makes the module not load at all) Alternatively, linking explicitly against lua_shared.so makes luaL_setfuncs actually work so you can remove the definition from ffi.h entirely
    This module now loads successfully and produces the ffi global. I can call ffi.cdef and ffi.new etc all without issues.

However, when I try to call even the most basic function like ffi.C.sleep(5) I get a segfault.

I cannot seem to see anything useful in the crashdump, it just exploes somehwere in lua_shared.so
I have also tried running the 32-bit version of GMod (srcds) on that branch and that segfaults as well.

If there is additional information that might be useful, let me know.

Crash dump attached.
crash.dmp.zip

Requiring

Hello again, we installed it on our server but we're now dealing with a new problem.
We expected that the right way to set it up was this:
ffi = require("ffi")

But then we printed the value of 'ffi' and we figured out that require("ffi") returns nil, so we're not sure about how we should correctly load the library.

  • The installation was correct, it doesn't give any errors when you load the module.

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.