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

Why is main.o installed? #811

Open
LiberalArtist opened this issue Feb 28, 2024 · 3 comments
Open

Why is main.o installed? #811

LiberalArtist opened this issue Feb 28, 2024 · 3 comments

Comments

@LiberalArtist
Copy link
Contributor

I noticed that main.o is installed, e.g. as /usr/lib/csv9.5.8/ta6le/main.o. I see that this was done intentionally in fd7812d, but it's not clear to me why or what it is useful for. Grepping the repository only turned up the changelog entry and the code in bintar.zuo and install.zuo that installs it.

@LdBeth
Copy link
Contributor

LdBeth commented Mar 8, 2024

I think the idea is to let user build a scheme executable with extra C functions linked to libkernel.a and main.o, without the need to distribute the user extended C functions as a separate dynamic library file.

@LiberalArtist
Copy link
Contributor Author

I think the idea is to let user build a scheme executable with extra C functions linked to libkernel.a and main.o, without the need to distribute the user extended C functions as a separate dynamic library file.

Interesting! I can see how that would work, though I wouldn't have thought of that approach.

Does anyone know of other software that distributes something similar to this main.o file?

@LdBeth
Copy link
Contributor

LdBeth commented Jun 7, 2024

So (on macOS)

cc libz.a liblz4.a libkernel.a main.o -o foo -liconv -lncurses

would produce an executable works identical to petite or scheme, without need to access the source code. I think this design was settle down long before when Chez was still closed source and the distribution of main.o is only for completeness, and to create binary executable if any of the linked shared libraries, for example ncurses, on the target system changes, without need to request a new binary from software vendor.

Also it is worth mention the version 7 user guide already mentioned the kernel can be a shared library. The program might have been distributed for some now obscure UNIX variants so it is very likely the case why object files are included when sources aren't available since while the object file format can be compatible the system shared libraries might not be the same.

https://www.scheme.com/csug7/use.html#./use:h7

My other conjecture about making additional C code was probably never be applied in reality since it still requires some hack to hook additional code into the main function to register C functions to the runtime to make them available to Scheme.

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

No branches or pull requests

2 participants