-
Notifications
You must be signed in to change notification settings - Fork 569
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
compiler is optimizing unreferenced parameter in CompilerGLSL::type_to_array_glsl and causing linking issues #2338
Comments
Are you sure you declared that method correctly in your own sources? Where is that reference to |
This is how I used it in my own sources:
the first Line of code here already caused this linker error I am compiling a DLL on Windows with Visual Studio v143 and ISO C++ 17 Standard |
I have no idea what is going on here. MSVC is built in CI and it links fine there. There are no uses of type_to_array_glsl with one argument in the code base. |
I am also quite confused because this method is never called even after I was able to successfully build and run it. But my compiler does not let me build it without this workaround. |
If there is a rational explanation for this, I can consider it, but I won't add a random hack like this without understanding the root cause. Does this reproduce when building SPIRV-Cross as-is? |
I will investigate this further. I actually used dumpbin to see if the symbol is exported and it actually is, which confuses me even more. I don’t expect you to add hacky code. I just wanted to point out that I encountered the problem because it took me a day just to figure out why my compiler is giving me a linker error even though everything seems to be correct. I just don't understand why my compiler is expecting I am actually building my Project using CMake and added the SPIRV-Cross as a submodule into my Project, which could be one factor, which causes this problem. If other people encounter the same problem, at least there is already a quick solution. But I try to look into it and try to understand this linker error. Building SPIRV-Cross as-is does not causes any problems.
Only after adding this line of code |
in file spirv_glsl.cpp you have a definition of this function:
as you can see, the second parameter is unnamed and unused. This is causing problems if I try to use this function from outside the library:
As you can see my compiler is trying to link this function which does not exist:
spirv_cross::CompilerGLSL::type_to_array_glsl(struct spirv_cross::SPIRType const &)
I fixed it for me by declaring and defning a second function, which takes only one parameter:
spirv_glsl.hpp:
spirv_glsl.cpp:
The text was updated successfully, but these errors were encountered: