Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

luaperks.lib and other lua library information? #63

Closed
bbbradsmith opened this issue Jun 21, 2019 · 7 comments
Closed

luaperks.lib and other lua library information? #63

bbbradsmith opened this issue Jun 21, 2019 · 7 comments
Labels
question Further information is requested

Comments

@bbbradsmith
Copy link
Contributor

bbbradsmith commented Jun 21, 2019

I have some questions about the lua related libraries in FCEUX:

  1. What is luaperks.lib and how is it obtained/built? Additionally, would it be better placed somewhere like src/drivers/win/lua/win32/ rather than vc/? Is there a 64-bit version?

  2. Are the lua libraries in src/drivers/win/lua/ custom built, or are these from an official lua release?

  3. What is lua51.dll? Official releases only seem to have lua5.1.dll. (Edit: for future reference, lua51.dll is in standard lua distribution only for up to vc12 but not vc14 or vc15, which was why I couldn't find its source.)

  4. What is src/lua/ used for? There is a vcproj in there that seems to build a lua.lib, but it doesn't seem to be used? The source files here are included in the VC build, it seems, but are excluded from the build.

  5. There's also auxlib.lib, which is mentioned in the main README but it doesn't seem to be included in the build. Does this have any current function? (Edit: I guess I meant auxlib.lua, there is no lib. Disregard.)

Is there anything else important to know about the lua stuff?

@bbbradsmith bbbradsmith added the question Further information is requested label Jun 21, 2019
@vadosnaprimer
Copy link

@bbbradsmith
Copy link
Contributor Author

Thank you. I'm sure that's it.

@vadosnaprimer
Copy link

I guess it should be a part of fceux codebase if it's the right thing. @zeromus?

@bbbradsmith
Copy link
Contributor Author

bbbradsmith commented Jun 22, 2019

Well it's close enough, I just needed to know where to find it. All I would really suggest doing is:

  1. Move vc/luaperks.lib to src/drivers/win/lua/win32 instead.
  2. Leave a text document nearby explaining where the lib came from.

I've done this already in the x64-ready branch I'm preparing.

I still don't know what lua51.dll is, though, or if src/lua or auxlib.lua have any function. I imagine the latter two could be deleted, but not sure. The DLL I have no clue what it does.

@bbbradsmith
Copy link
Contributor Author

bbbradsmith commented Jun 22, 2019

It seems that lua51.dll and lua5.1.dll have the same set of exports, but lua51 has very little actual data in it. Some sort of dummy version of the library with everything removed?

I see lua51 is used by a CheckLua function that just loads it then frees it immediately to check that it exists. It doesn't seem to actually do anything with it? Change that added it.

I found this note in the 2.2.2 changes: Dynamic link to lua51.dll instead of static linking, because some external libraries might crash without lua51.dll

Before that change, it looks sorta like lua51 was just the regular lua library/DLL but renamed? (Maybe we didn't like the . in the filename in 2010?) The current version seems like some stub kludge to keep something happy but I'm not sure what yet.

@zeromus
Copy link
Contributor

zeromus commented Jun 22, 2019

different lua libraries reference lua51.dll or lua5.1.dll. It's standard to deploy both of them, and the small one is nothing but a dummy thingy to keep half the libraries happy. It isn't our kludge, it's a standard kludge.

the lua sources that are checked in are for linux because there was no luaperks static lib builds for that. Of course linux users would probably rather use their distro install of lua-devel or whatever, but there are virtually no lua+fceux+linux users.

I don't remember why we use our own lua. Maybe we used to have it modified. Maybe we used lua private functions. Maybe we used lua struct layout details and couldnt warrant compatibility with whatever random ass lua dlls some clowns bring. (historically, the lua APis lack something you need and so you have to do it yourself). I think it's possible that 3rd party lua libraries (or lua itself) explode when you try to use them in an incompatible process (incompatible build options and initialization logic). My static linking them all together could have been a desperate attempt to bring them to life so they could be used at all.

I don't know why some other guy decided years ago to apparently use the dll instead. Nobody's complained about anything besides the usual "my 3rd party library doesn't work" so it must be benign. But it should result in mixing the DLL lua with the static linked luaperks, and that should restrict what DLL versions can be used.

luaperks should not be part of the codebase. it's right there in another repository.

But we should try shitcanning all the static stuff and shut everyone up forever, and if we can remember why we static linked and possibly customized it, write down what nice thing that gave us that we can't have any more, so we don't forget it.

Why do you need an x64 fceux?

@bbbradsmith
Copy link
Contributor Author

Thanks, that answers all of my questions I think. I'll close this.

As for your question about x64 FCEUX, some reasons were given here: #57

It'd probably be better to discuss it there than here, I just wanted to understand the lua build/library structure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants