-
Notifications
You must be signed in to change notification settings - Fork 15.6k
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
Add annotations for exporting generated functions from a Windows DLL #13726
Comments
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment. This issue is labeled |
Not stale. |
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment. This issue is labeled |
This is not stale, and there's an on open PR for this as well, at least in the context of upb (for now): #14981 |
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment. This issue is labeled |
Not stale, and has a new PR now too: #17079 |
…7079) Picking up #14981 from @dawidcha after several months of radio silence. Quoting the OP of that PR: > I have been collaborating with the grpc developers to make it possible to build that library as a Windows DLL - a couple of PRs were already merged, more like [grpc/grpc#34345](grpc/grpc#34345) are pending. > > The grpc library incorporates some upb-generated, and upbdefs-generated code into grpc.dll, which is referenced by other code that consumes the library. Since this is now a DLL, that code doesn't know how to link to these generated symbols because they are not annotated with __declspec(dllimport). > > This PR aims to fix that by introducing a parameter 'dllexport_tag' to the upb and upbdefs plugins. That parameter should be a string e.g. MYAPP_DLL and when set, the extern symbols are annotated with a macro with that name. This can either be set externally to __declspec(dllimport) or, as is usual practice, when compiling code into a DLL, the macro <dllexport_tag>_EXPORT (i.e. MYAPP_DLL_EXPORT) is defined, and when consuming the DLL <dllexport_tag>_IMPORT is defined if neither are defined then the MYAPP_DLL macro becomes empty string which is what you want for building a static library. > > This is a continuation of #14230 > > Fixes: #14255 Towards #13726 Closes #14981 Closes #17079 COPYBARA_INTEGRATE_REVIEW=#17079 from h-vetinari:add_dll_tags 523b92a FUTURE_COPYBARA_INTEGRATE_REVIEW=#17079 from h-vetinari:add_dll_tags 523b92a PiperOrigin-RevId: 641996346
…7079) Picking up #14981 from @dawidcha after several months of radio silence. Quoting the OP of that PR: > I have been collaborating with the grpc developers to make it possible to build that library as a Windows DLL - a couple of PRs were already merged, more like [grpc/grpc#34345](grpc/grpc#34345) are pending. > > The grpc library incorporates some upb-generated, and upbdefs-generated code into grpc.dll, which is referenced by other code that consumes the library. Since this is now a DLL, that code doesn't know how to link to these generated symbols because they are not annotated with __declspec(dllimport). > > This PR aims to fix that by introducing a parameter 'dllexport_tag' to the upb and upbdefs plugins. That parameter should be a string e.g. MYAPP_DLL and when set, the extern symbols are annotated with a macro with that name. This can either be set externally to __declspec(dllimport) or, as is usual practice, when compiling code into a DLL, the macro <dllexport_tag>_EXPORT (i.e. MYAPP_DLL_EXPORT) is defined, and when consuming the DLL <dllexport_tag>_IMPORT is defined if neither are defined then the MYAPP_DLL macro becomes empty string which is what you want for building a static library. > > This is a continuation of #14230 > > Fixes: #14255 Towards #13726 Closes #14981 Closes #17079 COPYBARA_INTEGRATE_REVIEW=#17079 from h-vetinari:add_dll_tags 523b92a FUTURE_COPYBARA_INTEGRATE_REVIEW=#17079 from h-vetinari:add_dll_tags 523b92a PiperOrigin-RevId: 641996346
…7079) Picking up #14981 from @dawidcha after several months of radio silence. Quoting the OP of that PR: > I have been collaborating with the grpc developers to make it possible to build that library as a Windows DLL - a couple of PRs were already merged, more like [grpc/grpc#34345](grpc/grpc#34345) are pending. > > The grpc library incorporates some upb-generated, and upbdefs-generated code into grpc.dll, which is referenced by other code that consumes the library. Since this is now a DLL, that code doesn't know how to link to these generated symbols because they are not annotated with __declspec(dllimport). > > This PR aims to fix that by introducing a parameter 'dllexport_tag' to the upb and upbdefs plugins. That parameter should be a string e.g. MYAPP_DLL and when set, the extern symbols are annotated with a macro with that name. This can either be set externally to __declspec(dllimport) or, as is usual practice, when compiling code into a DLL, the macro <dllexport_tag>_EXPORT (i.e. MYAPP_DLL_EXPORT) is defined, and when consuming the DLL <dllexport_tag>_IMPORT is defined if neither are defined then the MYAPP_DLL macro becomes empty string which is what you want for building a static library. > > This is a continuation of #14230 > > Fixes: #14255 Towards #13726 Closes #14981 Closes #17079 COPYBARA_INTEGRATE_REVIEW=#17079 from h-vetinari:add_dll_tags 523b92a FUTURE_COPYBARA_INTEGRATE_REVIEW=#17079 from h-vetinari:add_dll_tags 523b92a PiperOrigin-RevId: 641996346
…7079) Picking up #14981 from @dawidcha after several months of radio silence. Quoting the OP of that PR: > I have been collaborating with the grpc developers to make it possible to build that library as a Windows DLL - a couple of PRs were already merged, more like [grpc/grpc#34345](grpc/grpc#34345) are pending. > > The grpc library incorporates some upb-generated, and upbdefs-generated code into grpc.dll, which is referenced by other code that consumes the library. Since this is now a DLL, that code doesn't know how to link to these generated symbols because they are not annotated with __declspec(dllimport). > > This PR aims to fix that by introducing a parameter 'dllexport_tag' to the upb and upbdefs plugins. That parameter should be a string e.g. MYAPP_DLL and when set, the extern symbols are annotated with a macro with that name. This can either be set externally to __declspec(dllimport) or, as is usual practice, when compiling code into a DLL, the macro <dllexport_tag>_EXPORT (i.e. MYAPP_DLL_EXPORT) is defined, and when consuming the DLL <dllexport_tag>_IMPORT is defined if neither are defined then the MYAPP_DLL macro becomes empty string which is what you want for building a static library. > > This is a continuation of #14230 > > Fixes: #14255 Towards #13726 Closes #14981 Closes #17079 COPYBARA_INTEGRATE_REVIEW=#17079 from h-vetinari:add_dll_tags 523b92a FUTURE_COPYBARA_INTEGRATE_REVIEW=#17079 from h-vetinari:add_dll_tags 523b92a PiperOrigin-RevId: 641996346
…7079) Picking up #14981 from @dawidcha after several months of radio silence. Quoting the OP of that PR: > I have been collaborating with the grpc developers to make it possible to build that library as a Windows DLL - a couple of PRs were already merged, more like [grpc/grpc#34345](grpc/grpc#34345) are pending. > > The grpc library incorporates some upb-generated, and upbdefs-generated code into grpc.dll, which is referenced by other code that consumes the library. Since this is now a DLL, that code doesn't know how to link to these generated symbols because they are not annotated with __declspec(dllimport). > > This PR aims to fix that by introducing a parameter 'dllexport_tag' to the upb and upbdefs plugins. That parameter should be a string e.g. MYAPP_DLL and when set, the extern symbols are annotated with a macro with that name. This can either be set externally to __declspec(dllimport) or, as is usual practice, when compiling code into a DLL, the macro <dllexport_tag>_EXPORT (i.e. MYAPP_DLL_EXPORT) is defined, and when consuming the DLL <dllexport_tag>_IMPORT is defined if neither are defined then the MYAPP_DLL macro becomes empty string which is what you want for building a static library. > > This is a continuation of #14230 > > Fixes: #14255 Towards #13726 Closes #14981 Closes #17079 COPYBARA_INTEGRATE_REVIEW=#17079 from h-vetinari:add_dll_tags 523b92a FUTURE_COPYBARA_INTEGRATE_REVIEW=#17079 from h-vetinari:add_dll_tags 523b92a PiperOrigin-RevId: 641996346
…7079) Picking up #14981 from @dawidcha after several months of radio silence. Quoting the OP of that PR: > I have been collaborating with the grpc developers to make it possible to build that library as a Windows DLL - a couple of PRs were already merged, more like [grpc/grpc#34345](grpc/grpc#34345) are pending. > > The grpc library incorporates some upb-generated, and upbdefs-generated code into grpc.dll, which is referenced by other code that consumes the library. Since this is now a DLL, that code doesn't know how to link to these generated symbols because they are not annotated with __declspec(dllimport). > > This PR aims to fix that by introducing a parameter 'dllexport_tag' to the upb and upbdefs plugins. That parameter should be a string e.g. MYAPP_DLL and when set, the extern symbols are annotated with a macro with that name. This can either be set externally to __declspec(dllimport) or, as is usual practice, when compiling code into a DLL, the macro <dllexport_tag>_EXPORT (i.e. MYAPP_DLL_EXPORT) is defined, and when consuming the DLL <dllexport_tag>_IMPORT is defined if neither are defined then the MYAPP_DLL macro becomes empty string which is what you want for building a static library. > > This is a continuation of #14230 > > Fixes: #14255 Towards #13726 Closes #14981 Closes #17079 COPYBARA_INTEGRATE_REVIEW=#17079 from h-vetinari:add_dll_tags 34927b1 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17079 from h-vetinari:add_dll_tags 34927b1 PiperOrigin-RevId: 642315126
…7079) Picking up #14981 from @dawidcha after several months of radio silence. Quoting the OP of that PR: > I have been collaborating with the grpc developers to make it possible to build that library as a Windows DLL - a couple of PRs were already merged, more like [grpc/grpc#34345](grpc/grpc#34345) are pending. > > The grpc library incorporates some upb-generated, and upbdefs-generated code into grpc.dll, which is referenced by other code that consumes the library. Since this is now a DLL, that code doesn't know how to link to these generated symbols because they are not annotated with __declspec(dllimport). > > This PR aims to fix that by introducing a parameter 'dllexport_tag' to the upb and upbdefs plugins. That parameter should be a string e.g. MYAPP_DLL and when set, the extern symbols are annotated with a macro with that name. This can either be set externally to __declspec(dllimport) or, as is usual practice, when compiling code into a DLL, the macro <dllexport_tag>_EXPORT (i.e. MYAPP_DLL_EXPORT) is defined, and when consuming the DLL <dllexport_tag>_IMPORT is defined if neither are defined then the MYAPP_DLL macro becomes empty string which is what you want for building a static library. > > This is a continuation of #14230 > > Fixes: #14255 Towards #13726 Closes #14981 Closes #17079 COPYBARA_INTEGRATE_REVIEW=#17079 from h-vetinari:add_dll_tags 34927b1 PiperOrigin-RevId: 642622258
…otocolbuffers#17079) Picking up protocolbuffers#14981 from @dawidcha after several months of radio silence. Quoting the OP of that PR: > I have been collaborating with the grpc developers to make it possible to build that library as a Windows DLL - a couple of PRs were already merged, more like [grpc/grpc#34345](grpc/grpc#34345) are pending. > > The grpc library incorporates some upb-generated, and upbdefs-generated code into grpc.dll, which is referenced by other code that consumes the library. Since this is now a DLL, that code doesn't know how to link to these generated symbols because they are not annotated with __declspec(dllimport). > > This PR aims to fix that by introducing a parameter 'dllexport_tag' to the upb and upbdefs plugins. That parameter should be a string e.g. MYAPP_DLL and when set, the extern symbols are annotated with a macro with that name. This can either be set externally to __declspec(dllimport) or, as is usual practice, when compiling code into a DLL, the macro <dllexport_tag>_EXPORT (i.e. MYAPP_DLL_EXPORT) is defined, and when consuming the DLL <dllexport_tag>_IMPORT is defined if neither are defined then the MYAPP_DLL macro becomes empty string which is what you want for building a static library. > > This is a continuation of protocolbuffers#14230 > > Fixes: protocolbuffers#14255 Towards protocolbuffers#13726 Closes protocolbuffers#14981 Closes protocolbuffers#17079 COPYBARA_INTEGRATE_REVIEW=protocolbuffers#17079 from h-vetinari:add_dll_tags 34927b1 PiperOrigin-RevId: 642622258
…otocolbuffers#17079) Picking up protocolbuffers#14981 from @dawidcha after several months of radio silence. Quoting the OP of that PR: > I have been collaborating with the grpc developers to make it possible to build that library as a Windows DLL - a couple of PRs were already merged, more like [grpc/grpc#34345](grpc/grpc#34345) are pending. > > The grpc library incorporates some upb-generated, and upbdefs-generated code into grpc.dll, which is referenced by other code that consumes the library. Since this is now a DLL, that code doesn't know how to link to these generated symbols because they are not annotated with __declspec(dllimport). > > This PR aims to fix that by introducing a parameter 'dllexport_tag' to the upb and upbdefs plugins. That parameter should be a string e.g. MYAPP_DLL and when set, the extern symbols are annotated with a macro with that name. This can either be set externally to __declspec(dllimport) or, as is usual practice, when compiling code into a DLL, the macro <dllexport_tag>_EXPORT (i.e. MYAPP_DLL_EXPORT) is defined, and when consuming the DLL <dllexport_tag>_IMPORT is defined if neither are defined then the MYAPP_DLL macro becomes empty string which is what you want for building a static library. > > This is a continuation of protocolbuffers#14230 > > Fixes: protocolbuffers#14255 Towards protocolbuffers#13726 Closes protocolbuffers#14981 Closes protocolbuffers#17079 COPYBARA_INTEGRATE_REVIEW=protocolbuffers#17079 from h-vetinari:add_dll_tags 34927b1 PiperOrigin-RevId: 642622258
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment. This issue is labeled |
Not stale |
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment. This issue is labeled |
Not stale (c.f. also #19422) |
I'm currently engaged in some work with gRPC aiming at merging a PR which permits gRPC to be built as a dynamic library under Windows (i.e. a DLL). here. gRPC makes use of μpb and needs to expose symbols generated by it from a DLL. That requires that the functions marked as extern be annotated with '__declspec(dllexport)' when compiled and '__declspec(dllimport)' when consumed.
For the protoc compiler, this is achieved by prefixing the file output location on the command line with dllexport_decl=MY_EXPORT_MACRO, and then defining MY_EXPORT_MACRO as either __declspec(dllimport) or __declspec(dllexport); or empty string, as appropriate, but this feature doesn't appear to be available in μpb.
Can something similar be added?
The text was updated successfully, but these errors were encountered: