1

I would like to build and integrate wolfssl statically in a c++ Windows project.

I've tried to follow the official tutorial, but this seems to give a .dll, which is, correct me if I am wrong, dynamic.

Is there any solution to build a .lib and integrate it during compilation ?

If this is the case, what is the command to integrate this .lib to a makefile ?

Here is the makefile I tried to use, but functions of wolfssl.lib are still not found :

CC=mingw32-g++
CFLAGS=-Wall -s -Os -g
LDFLAGS=-shared-libstdc++ -std=c++11 -static -L. -lwolfssl.lib
EXECNAME=main
O_FILES=Main.o

all: $(O_FILES)
$(CC) -o $(EXECNAME) $(O_FILES)

Main.o: Main.cpp Global.h
$(CC) $(LDFLAGS) $(CFLAGS) $(COMPFLAGS) -c Main.cpp -o Main.o

If something isn't clear, I can add needed details.

  • Your problem is going to be the compatibility (or lack of it) between code generated by MSVC and code generated by MinGW. The different library formats might also be a problem. This is one reason for using DLLs in the first place. http://mingw.org/wiki/Interoperability_of_Libraries_Created_by_Different_Compiler_Brands – john Mar 11 '19 at 08:15
  • you have to tell your compiler about your wolfssl's header files - include them into your build and also in your code. so your compiler knows about the names, sizes etc of the types and so on. – skratchi.at Mar 11 '19 at 08:19
  • If you continue to have issues once creating the .lib using the wolfssl64.sln I noted in the answer below let us know. Since wolfSSL uses the ```extern "C"``` wrappers on ALL of our headers and our source code is written entirely in C there should be no major compatibility issues with MinGW. – Kaleb Mar 14 '19 at 22:59

1 Answers1

0

Answer for:

Is there any solution to build a .lib...

Using the official tutorial I've updated items in step 2 below:

Step 2: Start Microsoft Visual Studio

 - In Visual Studio, go to “File ? Open Project”
 - Navigate to the directory where you downloaded wolfSSL (“Desktop”
   above) and find the wolfssl directory, double click it.
 - Scroll to the bottom and locate “wolfssl64.sln”

NOTE: Rather than picking wolfssl.sln, instead open wolfssl64.sln. The wolfssl64.sln offers build options for the following:

STATIC LIB OPTIONS:

  • Win32 | Debug
  • Win32 | Release
  • x64 | Debug
  • x64 | Release

DYNAMIC (Shared) LIB OPTIONS

  • Win32 | DLL Debug
  • Win32 | DLL Release
  • x64 | DLL Debug
  • x64 | DLL Release

If you have any issues working with the wolfssl64.sln please feel free to shoot an email to support@wolfssl.com for more direct help, our support staff welcomes any and all questions.

If you ever post an issue here on stack overflow and do not see an update from one of the wolfSSL team members for an extended duration you can also email support@wolfssl.com with a link to your stack overflow question and we will be happy to come over and post an answer or suggestion.

Warm Regards,

K

Kaleb
  • 591
  • 4
  • 17