Linking gRPC (C++) into my .dll

57 views
Skip to first unread message

scha...@artandlogic.com

unread,
Nov 25, 2019, 7:00:17 PM11/25/19
to grpc.io
Need to write a Windows .dll for a project.  Within my dll, I need to use protobufs and grpc to get some data.  Having a really hard time linking everything together due to several errors I cannot seem to fix.

Application and some of the other code I'm using are compiled with /MD, not /MT.

Originally, I had installed gRPC like this:

vcpkg.exe install zlib:x64-windows-static
vcpkg.exe install c-ares:x64-windows-static
vcpkg.exe install openssl:x64-windows-static
vcpkg.exe install protobuf[zlib]:x64-windows-static
vcpkg.exe install grpc:x64-windows-static

But that seems to compile with /MT, and the rest of the code and the application is built with /MD, so I tried to switch to this:

vcpkg.exe install zlib:x64-windows
vcpkg.exe install c-ares:x64-windows
vcpkg.exe install openssl:x64-windows
vcpkg.exe install protobuf[zlib]:x64-windows
vcpkg.exe install grpc:x64-windows

Instead of giving me .libs, this gave me .dll files.

Now I'm trying to build grpc directly like this:

git clone -b v1.20.0 https://github.com/grpc/grpc
cd grpc
git submodule update --init
mkdir build64
cd build64
cmake ..

Once I loaded the .sln file and built it in VisualStudio, I think this gave me over 100 .lib files, some of which also includes protobuffers.  Do I add all 100+ .lib files into my project?  I tried adding them individually to fix obvious unresolved externals, but I'm thinking I must be going about this the wrong way and could use some hints.

Thanks,

Stéphane

Nicolas Noble

unread,
Nov 27, 2019, 1:25:42 PM11/27/19
to grpc.io
Getting some sense of the errors you're getting would be useful.

I would suggest first trying to get a normal .exe running, which can then be something you adapt to your specific usage case.
Reply all
Reply to author
Forward
0 new messages