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

Compile Godot Engine as a library. #62490

Closed
wants to merge 1 commit into from
Closed

Conversation

fire
Copy link
Member

@fire fire commented Jun 28, 2022

Fixes: godotengine/godot-proposals#4773

  • Replace the entry points of main of Windows and Linux.
  • Replace the entry points of osx.
  • Replace the entry points of android.
  • Replace the entry points of ios.
  • Replace the entry points of uwp.
  • Investigate the entry points of Javascript.
  • Cannot avoid 64k symbols limit on Windows dll format.

Part of the V-Sekai group. https://github.com/v-sekai

@fire fire requested a review from a team as a code owner June 28, 2022 17:04
@fire fire marked this pull request as draft June 28, 2022 17:05
@Chaosus Chaosus added this to the 4.0 milestone Jun 28, 2022
@Chaosus Chaosus requested a review from reduz June 28, 2022 17:06
@fire fire force-pushed the libgodot branch 4 times, most recently from a2cdada to 107cebf Compare June 28, 2022 17:23
@fire fire marked this pull request as ready for review June 28, 2022 17:24
@fire fire requested review from a team as code owners June 28, 2022 17:24
@fire
Copy link
Member Author

fire commented Jun 28, 2022

For Windows only godot_main is exposed. For Mac and Linux all symbols are exposed.

image

See also https://github.com/lucasg/Dependencies.

@fire fire force-pushed the libgodot branch 4 times, most recently from 6770988 to 3392645 Compare June 28, 2022 18:38
@Faless
Copy link
Collaborator

Faless commented Jun 28, 2022

My understanding is that calling godot_main will basically result in the main loop starting and the function only returning when the main loop quits. Am I missing something? 👀

@fire
Copy link
Member Author

fire commented Jun 28, 2022

Yes, in my example and tested on the Linux platform I run the scenetree iteration loop manually.

https://github.com/V-Sekai/godot/blob/elixir/c_src/godot/godot_elixir.cpp

@Faless
Copy link
Collaborator

Faless commented Jun 28, 2022

I see, so the windows version which only exposes the godot_main isn't usable for this purpose right?

@fire
Copy link
Member Author

fire commented Jun 28, 2022

There are three problems on Windows.

  1. there's a 64k symbols limit.

scons -j32 library_type=shared_library use_llvm=yes use_mingw=yes LINKFLAGS='-Wl,--export-all-symbols -Wl,-pdb=' CCFLAGS='-g -gcodeview' debug_symbols=no

  1. If we can't expose everything, there's ways to force map a list of symbols.

https://stackoverflow.com/a/54067711

  1. Need know what symbols to keep.

@fire fire force-pushed the libgodot branch 2 times, most recently from b052ba5 to 1cbf9d2 Compare July 3, 2022 14:51
@bruvzg
Copy link
Member

bruvzg commented Jul 4, 2022

If we can't expose everything, there's ways to force map a list of symbols.

It is necessary to directly exposing everything? Besides, exported C++ symbols are not portable and will be usable only if main app is built with exactly same compiler and C++ runtime version, which kinda makes it almost useless.

Maybe it's better to expose only a few pure-C wrappers for OS/Main initialization / finalization, and functions to get access GDExtension interface struct and register initializers/terminators, the and the rest can be done via GDExtension API.

@fire
Copy link
Member Author

fire commented Jul 4, 2022

It’s a good suggestion to get at the gdextension api. Or at least the classdb and execution of the api. Can look

@fire
Copy link
Member Author

fire commented Jul 12, 2022

I don't have time to salvage this proposal to use the design from @bruvzg before the feature freeze, but it's a good idea.

@fire fire modified the milestones: 4.0, 4.x Aug 24, 2022
@fire
Copy link
Member Author

fire commented Sep 7, 2022

Can be salvaged or used as is. Closing for now.

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

Successfully merging this pull request may close these issues.

Build Godot Engine as a shared library
6 participants