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

v.reflection does not populate when compiled as a shared library (-shared) #20798

Closed
jcweaver997 opened this issue Feb 12, 2024 · 2 comments
Closed
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@jcweaver997
Copy link

jcweaver997 commented Feb 12, 2024

Describe the bug

v.reflection does not populate when compiled as a shared library (-shared)

Everything is empty, here is an example:
image
image

This causes "some" print formatting to fail for gdextension. Simple values like number types work fine, but printing structs does not. All types still have non-zero T.idx's but the reflection tables are empty.

Reproduction Steps

To produce this, I was working on vgdextension. Godot loads the shared library and calls the entry point function. As this requires you to create a shared library and load it dynamically, its a bit harder to get setup. This can be easily reproduced using the example for jcweaver997/vgdextension, importing v.reflection, and trying to get a type or list the types. String formatting a struct will cause the program to crash.

Expected Behavior

v.reflection tables to be populated and no crashing when string formatting a struct

Current Behavior

v.reflection tables are empty and crashes are experienced when string formatting a struct

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.4 16574df

Environment details (OS name and version, etc.)

V full version: V 0.4.4 afd74ad.16574df
OS: windows, Microsoft Windows 11 Pro v26052 64-bit
Processor: 24 cpus, 64bit, little endian,

getwd: C:\Users\jcwea\Documents\git\jvmmo
vexe: C:\Users\jcwea\Documents\git\v\v.exe
vexe mtime: 2024-02-10 00:25:17

vroot: OK, value: C:\Users\jcwea\Documents\git\v
VMODULES: OK, value: C:\Users\jcwea.vmodules
VTMP: OK, value: C:\Users\jcwea\AppData\Local\Temp\v_0

Git version: git version 2.40.0.windows.1
Git vroot status: weekly.2024.04-90-g16574df9 (22 commit(s) behind V master)
.git/config present: true

CC version: Error: 'cc' is not recognized as an internal or external command,
operable program or batch file.

thirdparty/tcc status: thirdparty-windows-amd64 b99a453d

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@jcweaver997 jcweaver997 added the Bug This tag is applied to issues which reports bugs. label Feb 12, 2024
@felipensp
Copy link
Member

For windows we have a _vinit_caller fn which is calleld on
image

It must be called to fill the reflection data as a non-shared one.

@jcweaver997
Copy link
Author

Thanks @felipensp, that makes sense. Everything appears to work using:

fn C._vinit(int, voidptr)

and calling this in the entrypoint:

C._vinit(0, unsafe{nil})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs.
Projects
None yet
Development

No branches or pull requests

2 participants