Hi,

Thanks for your explanations. I only add the path to the protobuf dll to 
the PATH environment variable. I read that it should be enough for Matlab 
to find the dll.
Michael Ngarimu what do you mean by "correctly provide the protobuf DLL to 
Matlab"? How did you do it?

Regards,
Adam

Michael Ngarimu a következőt írta (2025. február 1., szombat, 3:40:40 
UTC+1):

> This does not look like a protobuf issue to me. Is it possible this is 
> simply an issue that you haven't told Matlab how to find the protobuf DLL? 
>
> Where is the "could not find dll like" issue?
>
> Beyond the scope of this list, I have ,
> 1. used vcpkg to acquire protobuf 3.21.12,
> 2. taken your model and modified the LIB_PATH and INC_PATH to point to 
> location where vcpkg installed the protobuf headers and built libs,
> 3. rebuilt your s-function
>
> The only issue I ran into is Matlab S-Function builder gave a vague error 
> that it could not obtain sizes from the MEX file.... 
>
> but that was because the MEX failed to build completely... 
>
> but that was because Matlab doesn't know where to find the protobuf DLL. 
>
> How are you making the protobuf DLL available to Matlab?
>
> When I correctly provide the protobuf DLL to Matlab, I can see the value 
> you assign and retrieve through the protobuf::Timestamp (the value, 2) in 
> the outputs from your model.
> [image: Screenshot 2025-01-31 183750.png]
>
> On Friday, January 31, 2025 at 1:14:14 AM UTC-8 Ádám Boronyák 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/82662b51-59d9-479d-87a5-6b592fb196b0n%40googlegroups.com.

Reply via email to