Coder Social home page Coder Social logo

Comments (4)

creationix avatar creationix commented on August 15, 2024

ping @rjemanuele

from luvi.

rjemanuele avatar rjemanuele commented on August 15, 2024

Hi,

Yes, that is what luv_renamed.c does. It uses a Microsoft concept called Delay Loaded DLLs.

Since our extensions that are DLLs are built against the exports from luvi.exe, those DLLs look for luvi.exe for their unresolved symbols. Since luvi.exe can be renamed and packaged with an appended zip file to contain the lua code and DLLs it may not be able to find luvi.exe. Using the delay loading hooks, tell the operating system loading the DLLs what to do. In our case we catch the lookup of symbols from luvi.exe and redirect it to the current executable.

The delay loading failure hook needs to be in the DLL. In our case, we require some DLL library, that DLL loads, it has other symbols to resolve (including from our luvi.exe), the failure hook makes that redirection.

You may need to build your DLL in a certain way, without more information I cannot be sure. How we build extension DLLs is like this: https://github.com/virgo-agent-toolkit/lua-sigar/blob/master/CMakeLists.txt

from luvi.

starwing avatar starwing commented on August 15, 2024

Thank you for explaining!

I wonder there is a way to redirect dll's dependency without modify dll.

e.g. I have a foo.dll, it depends bar.dll, when I load foo.dll, I make foo.dll do not load bar.dll, but use process handler (GetModuleHandle(NULL)) to resolve symbols. Is that possible?

from luvi.

rjemanuele avatar rjemanuele commented on August 15, 2024

I believe you can look up each symbol you need thought GetModuleHandle(NULL), just seems like more work.

from luvi.

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.