Home > other >  How to create stub/services files with MATLAB grpc plugin?
How to create stub/services files with MATLAB grpc plugin?

Time:01-25

I'm using MatlabWithProtoV3 to create protoc.exe with matlab_out in Windows environment. I was able to create protoc and when I use

protoc.exe user.proto --matlab_out=./

It only creating matlab files for proto messages (files can be found in the bottom attachment) and it is not creating matlab files for services(client and server)

Then, I read about plugins and included the generator and plugin files to gRPC Source to create Matlab plugin and created the grpc_matlab_plugin.exe successfully.

Now, when I execute

protoc.exe user.proto --matlab_out=./ --grpc_out=./ --plugin=protoc-gen-grpc="D:\grpc\cmake\build\Debug\grpc_matlab_plugin.exe

I'm getting

pb_descriptor_LoginRequest.m: Tried to write the same file twice.
 pb_read_LoginRequest.m: Tried to write the same file twice. 
pb_descriptor_APIResponse.m: Tried to write the same file twice. 
pb_read_APIResponse.m: Tried to write the same file twice.
 pb_descriptor_Empty.m: Tried to write the same file twice. 
pb_read_Empty.m: Tried to write the same file twice.

error message and no files are getting created.

in gRPC repo, for C compiler i could find cpp_plugin.h has some codes to create service related files but similar file is not available for Matlab in here or here

Can you please let me know how to create Matlab files for services?

Attached the files created when I execute the above mentioned commands, sample_files.zip

Github issue

Thanks

CodePudding user response:

protobuf-matlab is just a protobuf plugin - it generates code to read/write protocol buffer.

Unfortunately it does not implement a gRPC plugin which would build the client stub and server.

If you are able to call your matlab code from another language, you could host the gRPC server externally, e.g. create a gRPC server in dotnet and use COM to call your matlab code.

  •  Tags:  
  • Related