It's hard to say what the root cause is, but the error message suggests that a global mutex pointer is null when it should not be.
My best guess would be that your setup is doing something unsupported with dynamic linking, such as perhaps unloading libprotobuf and reloading it again. The protobuf library has some global mutable state (including that mutex pointer) which I suspect would cause problems with unloading the library and loading it again. Another thing is that 3.21.12 is a somewhat old release and not officially supported anymore, so you might want to upgrade to a newer version as a first step. On Fri, Jan 31, 2025 at 1:14 AM Ádám Boronyák <[email protected]> wrote: > Hi, > > I would like to integrate and use protobuf C++ library in Simulink > S-functions on Windows 10. For this purpose I have installed protobuf > 3.21.12 using Visual Studio 2022 via vcpkg. I have created a simple > Simulink model (attached to the email) with an S-function builder. In this > S-function builder I set a library path to vcpkg lib folder and an include > path to vcpkg include folder to be able to find protobuf headers and > libraries. I set there also the libprotobuf.lib as an entry. In environment > variables I set path to the vcpkg bin folder because libprotobuf.lib links > to the corresponding dll file. So every link and entry have been set for > the project. > In my S-function in wrapper.cpp file (attached to the email), I create an > instance of the built-in Timestamp message, set the seconds field to 2 and > give it to the output of the S-function. After I compile the S-function or > try to run the Simulink model, Simulink freezes and after some time I get a > "could not find a dll" like issue which does not help to debug the issue. > I created a contact with Mathworks and they suggested a way to debug this. > So I opened Visual Studio, opened the wrapper file, set a break point to > the instance creation and attached the Matlab process to it. After I try to > run my Simulink model I get an access violation exception. I have attached > a screenshot about it. > Mathworks suggested that I should contact you to help troubleshooting this > issue. What is your opinion about it? What can cause this issue? > > Regards, > Adam > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion visit > https://groups.google.com/d/msgid/protobuf/5dcf267f-0d17-4ff5-8c73-f7eb3acc55b8n%40googlegroups.com > <https://groups.google.com/d/msgid/protobuf/5dcf267f-0d17-4ff5-8c73-f7eb3acc55b8n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/protobuf/CADqAXr580-LZrMUgPxqoLfRz_vv6vBLQV%3DMhA%3DcDGa%3DyfOumGA%40mail.gmail.com.
