Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems building on VS for Windows 10 #3

Closed
S0C1esq opened this issue Jun 30, 2020 · 12 comments
Closed

Problems building on VS for Windows 10 #3

S0C1esq opened this issue Jun 30, 2020 · 12 comments

Comments

@S0C1esq
Copy link

S0C1esq commented Jun 30, 2020

Hello,
Trying to build libHSM on Windows 10 to support py-HSM. Receiving the following errors below. Is there something else I need to configure first.

Thanks.

Severity Code Description Project File Line Suppression State
Error C1189 #error: Macro definition of snprintf conflicts with Standard Library function declaration libhsm c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h 1935
Error (active) E0065 expected a ';' libhsm C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\cstdio 52
Error (active) E0035 #error directive: Macro definition of snprintf conflicts with Standard Library function declaration libhsm C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\stdio.h 1935
Error (active) E0655 the modifier "__inline" is not allowed on this declaration libhsm C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\stdio.h 1940
Error C1083 Cannot open source file: 'ChrystokiConfiguration.cpp': No such file or directory libhsm C:\Users\George\libhsm-master\src\c1xx 1
Error C1083 Cannot open source file: 'c_bridge.cpp': No such file or directory libhsm C:\Users\G\libhsm-master\src\c1xx 1
Error C1083 Cannot open source file: 'ckbridge.cpp': No such file or directory libhsm C:\Users\G\libhsm-master\src\c1xx 1
Error C1083 Cannot open source file: 'DynamicLibrary.cpp': No such file or directory libhsm C:\Users\G\libhsm-master\src\c1xx 1
Warning C4005 'EXTERN_C': macro redefinition libhsm c:\users\george\libhsm-master\src\p11hsm.h 35
Error C2733 'connect': second C linkage of overloaded function not allowed libhsm c:\users\G\libhsm-master\src\p11hsm.h 77
Warning C4005 'snprintf': macro redefinition libhsm c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h 1933

@bentonstark
Copy link
Owner

bentonstark commented Jun 30, 2020

So the libhsm.vcxproj project file is very old and contains a lot of invalid file references directly to the Safenet Luna libraries. The following file references are completely invalid and need to be removed. I had meant to come back and clean this file up but never did. In addition the correct references need to be added back. You might want to just ignore this old project and create a new one to compile with MS C++ and Visual Studio. Alternatively you can cross compile with gcc or natively compile with gcc on a Windows target. This is a configuration that should work since this project ran exclusively on Windows before being ported to Linux. But it is possible there may need to be some precompiler directive tweeks to get it fully working. You also want to use the OS_WIN pre-processor directive.

ChrystokiConfiguration.cpp / .h
c_bridge.cpp / .h
ckbridge.cpp / .h
DynamicLibrary.cpp / .h

@S0C1esq
Copy link
Author

S0C1esq commented Jun 30, 2020 via email

@longnt89
Copy link

Hi @S0C1esq , have you ever recompiled libhsm.dll sucessfully?

I have been trying to do this with much effort but always got errors, for instances when I tried to recompile the source code of "libhsm" library with Visual Studio 2013 on Windows 10, I've had such errors in "p11hsm.cpp":

error C2070: 'char []': illegal sizeof operand

error C3861: 'LoadLibrary': identifier not found

error C2133: 'lib_path_null' : unknown size

error C2133: 'pMechanismList' : unknown size

error C2466: cannot allocate an array of constant size 0

@bentonstark could you please give me some hint to solve such problems?

Really appreciate your help!

@bentonstark
Copy link
Owner

This library first started out as a VS 2015 C++ library targeted for Windows 2008R2 to enable HSM access from C#. Since then I ported it and re-wrote it to compile on Linux with gcc and created an interface library in Python. I never ported it back to Windows so although it started on that platform it is bound to have some issues that need to be resolved if you compile with VS 2013 which is not fully C99 and C++11 compliant. Another option I have not tried is to use gcc and cross compile to Windows from Linux. Alternatively you could compile directly on Windows using gcc. I have not attempted either one of these options. Have you attempted to compile using gcc for Windows on Windows directly? https://solarianprogrammer.com/2019/11/05/install-gcc-windows/

@bentonstark
Copy link
Owner

error C3861: 'LoadLibrary': identifier not found
So LoadLibrary is an alias for LoadLibraryA or LoadLibraryAEx both of which are WIN32 APIs. So try changing the following code to specifically call LoadLibraryA
https://github.com/bentonstark/libhsm/blob/master/src/p11hsm.cpp#L66

error C2070: 'char []': illegal sizeof operand
error C2133: 'lib_path_null' : unknown size
error C2133: 'pMechanismList' : unknown size
error C2466: cannot allocate an array of constant size 0
These errors look like compiler error differences between gcc and MS C++ compiler. The VS 2013 compiler is rather old. I would use a more recent MSVC compiler that comes with VS 2019 if you can do that. If possible I would also configure MSVC in VS 2019 to stick to the standards.

@longnt89
Copy link

longnt89 commented Jan 28, 2021

Hi @bentonstark , thank you for your rapid response!
As your advice, I installed msys64 mingw on my windows 10 by the link you gave.
However I still have not compiled the dll successfully yet.
For instances, supposing I am in the /src directory then I used:
gcc -I./ -o libhsm.o p11hsm.cpp mechtype.cpp -D OS_WIN
(with and without -std=c++11 or c99 option) but it returns such errors:
image

And a lot of these:
image

Honestly I have no experience with gcc and mingw, I just looked up tutorials/infos from the Internet.

Could you point me the right way to go please?
Many thanks in advance.

@bentonstark
Copy link
Owner

So first things, you did add a OS_WIN declaration to your command line so that's good.

winsock.h is getting pulled into the build. You should be able to remove it by adding the #define WIN32_LEAN_AND_MEAN statement to the top of the p11hsm.h file as shown below.

--- p11hsm.h
#ifdef OS_WIN
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#else
#include <dlfcn.h>
#endif

The other issue is the reclaration of the snprintf function or lack of declaration. So when I compiled this thing with MSVC years ago, Microsoft supported snprintf but under the name _snprintf so I aliased it for windows builds only. It looks like the compiler is finding that definition for _snprintf in the file stdio.h but there is also now a snprintf that windows now supports in the stdio.h fil.

Try commenting out the following #define for snprintf.
--- p11hsm.h
#define snprintf _snprintf

@longnt89
Copy link

You're so pro @bentonstark !
After following your recommendation I finally managed to recompile libhsm.dll.
One more question: do I have to register that dll into my windows system? Because when I used "regsvr32" command to register the dll it told me that:

the module was loaded but the entry-point dllregisterserver was not found

This answer explains that the dll may not be a COM DLL so there is no need to register it:
https://social.msdn.microsoft.com/Forums/en-US/7cc969ba-716a-46f5-9dee-22673a2dbd45/module-was-loaded-but-the-entrypoint-dllregisterserver-was-not?forum=vbinterop
But do I have to put the dll into somewhere such as C:\windows\system32 ?

Suppose that recompiling libhsm.dll is the prerequisite before using your py-hsm library, I'd like to have some questions related to py-hsm, so I'll post them in your github py-hsm project, hope to get your help!

Thank you.

@bentonstark
Copy link
Owner

bentonstark commented Jan 29, 2021

It is not a COM object so you don't need to register it with the Windows registry. But it will need to be in the shell path for the Windows executable to find or in the same directory as the executable. For you the executable that will consume libhsm.dll via LoadLibrary() WIN32 API call will most likely be Python3.exe.

You can set the Windows path variable globally via the following instructions.
https://helpdeskgeek.com/windows-10/add-windows-path-environment-variable/

Or you can set the Windows Shell PATH variable for the current terminal session. So if libhsm.dll was located in C:\path-to-the-dll-directory you could set the path in your current shell and then run the following. Note that once your terminal session is closed the path will be removed.
c:\ set PATH=C:\path-to-the-dll-directory;%PATH%

@E-genin
Copy link

E-genin commented Nov 9, 2022

@bentonstark , I did the changes you suggested in the header files but I still get warnings same as @longnt89 :

In file included from p11hsm.cpp:22: p11hsm.h:35: warning: "EXTERN_C" redefined 35 | #define EXTERN_C extern "C" __declspec(dllexport) | In file included from /usr/include/w32api/minwindef.h:163, from /usr/include/w32api/windef.h:9, from /usr/include/w32api/windows.h:69, from p11hsm.h:28, from p11hsm.cpp:22: /usr/include/w32api/winnt.h:423: note: this is the location of the previous definition 423 | #define EXTERN_C extern "C" | In file included from oasis/../oasis/pkcs11.h:263, from oasis/cryptoki.h:78, from mechtype.h:15, from p11hsm.cpp:23: oasis/../oasis/../oasis/pkcs11f.h:34:1: warning: 'dllexport' attribute ignored [-Wattributes] 34 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:44:1: warning: 'dllexport' attribute ignored [-Wattributes] 44 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:53:1: warning: 'dllexport' attribute ignored [-Wattributes] 53 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:63:1: warning: 'dllexport' attribute ignored [-Wattributes] 63 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:77:1: warning: 'dllexport' attribute ignored [-Wattributes] 77 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:88:1: warning: 'dllexport' attribute ignored [-Wattributes] 88 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:99:1: warning: 'dllexport' attribute ignored [-Wattributes] 99 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:111:1: warning: 'dllexport' attribute ignored [-Wattributes] 111 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:123:1: warning: 'dllexport' attribute ignored [-Wattributes] 123 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:136:1: warning: 'dllexport' attribute ignored [-Wattributes] 136 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:147:1: warning: 'dllexport' attribute ignored [-Wattributes] 147 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:160:1: warning: 'dllexport' attribute ignored [-Wattributes] 160 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:177:1: warning: 'dllexport' attribute ignored [-Wattributes] 177 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:187:1: warning: 'dllexport' attribute ignored [-Wattributes] 187 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:196:1: warning: 'dllexport' attribute ignored [-Wattributes] 196 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:206:1: warning: 'dllexport' attribute ignored [-Wattributes] 206 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:218:1: warning: 'dllexport' attribute ignored [-Wattributes] 218 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:232:1: warning: 'dllexport' attribute ignored [-Wattributes] 232 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:244:1: warning: 'dllexport' attribute ignored [-Wattributes] 244 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:253:1: warning: 'dllexport' attribute ignored [-Wattributes] 253 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:268:1: warning: 'dllexport' attribute ignored [-Wattributes] 268 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:282:1: warning: 'dllexport' attribute ignored [-Wattributes] 282 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:292:1: warning: 'dllexport' attribute ignored [-Wattributes] 292 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:303:1: warning: 'dllexport' attribute ignored [-Wattributes] 303 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:316:1: warning: 'dllexport' attribute ignored [-Wattributes] 316 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:329:1: warning: 'dllexport' attribute ignored [-Wattributes] 329 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:341:1: warning: 'dllexport' attribute ignored [-Wattributes] 341 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:355:1: warning: 'dllexport' attribute ignored [-Wattributes] 355 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:365:1: warning: 'dllexport' attribute ignored [-Wattributes] 365 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:379:1: warning: 'dllexport' attribute ignored [-Wattributes] 379 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:392:1: warning: 'dllexport' attribute ignored [-Wattributes] 392 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:406:1: warning: 'dllexport' attribute ignored [-Wattributes] 406 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:418:1: warning: 'dllexport' attribute ignored [-Wattributes] 418 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:429:1: warning: 'dllexport' attribute ignored [-Wattributes] 429 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:442:1: warning: 'dllexport' attribute ignored [-Wattributes] 442 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:456:1: warning: 'dllexport' attribute ignored [-Wattributes] 456 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:468:1: warning: 'dllexport' attribute ignored [-Wattributes] 468 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:481:1: warning: 'dllexport' attribute ignored [-Wattributes] 481 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:494:1: warning: 'dllexport' attribute ignored [-Wattributes] 494 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:506:1: warning: 'dllexport' attribute ignored [-Wattributes] 506 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:518:1: warning: 'dllexport' attribute ignored [-Wattributes] 518 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:530:1: warning: 'dllexport' attribute ignored [-Wattributes] 530 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:547:1: warning: 'dllexport' attribute ignored [-Wattributes] 547 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:562:1: warning: 'dllexport' attribute ignored [-Wattributes] 562 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:575:1: warning: 'dllexport' attribute ignored [-Wattributes] 575 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:587:1: warning: 'dllexport' attribute ignored [-Wattributes] 587 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:599:1: warning: 'dllexport' attribute ignored [-Wattributes] 599 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:613:1: warning: 'dllexport' attribute ignored [-Wattributes] 613 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:629:1: warning: 'dllexport' attribute ignored [-Wattributes] 629 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:644:1: warning: 'dllexport' attribute ignored [-Wattributes] 644 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:657:1: warning: 'dllexport' attribute ignored [-Wattributes] 657 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:669:1: warning: 'dllexport' attribute ignored [-Wattributes] 669 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:681:1: warning: 'dllexport' attribute ignored [-Wattributes] 681 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:695:1: warning: 'dllexport' attribute ignored [-Wattributes] 695 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:712:1: warning: 'dllexport' attribute ignored [-Wattributes] 712 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:726:1: warning: 'dllexport' attribute ignored [-Wattributes] 726 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:740:1: warning: 'dllexport' attribute ignored [-Wattributes] 740 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:754:1: warning: 'dllexport' attribute ignored [-Wattributes] 754 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:771:1: warning: 'dllexport' attribute ignored [-Wattributes] 771 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:800:1: warning: 'dllexport' attribute ignored [-Wattributes] 800 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:814:1: warning: 'dllexport' attribute ignored [-Wattributes] 814 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:831:1: warning: 'dllexport' attribute ignored [-Wattributes] 831 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:846:1: warning: 'dllexport' attribute ignored [-Wattributes] 846 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:861:1: warning: 'dllexport' attribute ignored [-Wattributes] 861 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:872:1: warning: 'dllexport' attribute ignored [-Wattributes] 872 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:886:1: warning: 'dllexport' attribute ignored [-Wattributes] 886 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:896:1: warning: 'dllexport' attribute ignored [-Wattributes] 896 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:911:1: warning: 'dllexport' attribute ignored [-Wattributes] 911 | ); | ^ In file included from oasis/../oasis/pkcs11.h:263, from oasis/cryptoki.h:78, from mechtype.h:15, from mechtype.cpp:11: oasis/../oasis/../oasis/pkcs11f.h:34:1: warning: 'dllexport' attribute ignored [-Wattributes] 34 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:44:1: warning: 'dllexport' attribute ignored [-Wattributes] 44 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:53:1: warning: 'dllexport' attribute ignored [-Wattributes] 53 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:63:1: warning: 'dllexport' attribute ignored [-Wattributes] 63 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:77:1: warning: 'dllexport' attribute ignored [-Wattributes] 77 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:88:1: warning: 'dllexport' attribute ignored [-Wattributes] 88 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:99:1: warning: 'dllexport' attribute ignored [-Wattributes] 99 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:111:1: warning: 'dllexport' attribute ignored [-Wattributes] 111 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:123:1: warning: 'dllexport' attribute ignored [-Wattributes] 123 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:136:1: warning: 'dllexport' attribute ignored [-Wattributes] 136 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:147:1: warning: 'dllexport' attribute ignored [-Wattributes] 147 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:160:1: warning: 'dllexport' attribute ignored [-Wattributes] 160 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:177:1: warning: 'dllexport' attribute ignored [-Wattributes] 177 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:187:1: warning: 'dllexport' attribute ignored [-Wattributes] 187 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:196:1: warning: 'dllexport' attribute ignored [-Wattributes] 196 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:206:1: warning: 'dllexport' attribute ignored [-Wattributes] 206 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:218:1: warning: 'dllexport' attribute ignored [-Wattributes] 218 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:232:1: warning: 'dllexport' attribute ignored [-Wattributes] 232 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:244:1: warning: 'dllexport' attribute ignored [-Wattributes] 244 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:253:1: warning: 'dllexport' attribute ignored [-Wattributes] 253 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:268:1: warning: 'dllexport' attribute ignored [-Wattributes] 268 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:282:1: warning: 'dllexport' attribute ignored [-Wattributes] 282 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:292:1: warning: 'dllexport' attribute ignored [-Wattributes] 292 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:303:1: warning: 'dllexport' attribute ignored [-Wattributes] 303 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:316:1: warning: 'dllexport' attribute ignored [-Wattributes] 316 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:329:1: warning: 'dllexport' attribute ignored [-Wattributes] 329 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:341:1: warning: 'dllexport' attribute ignored [-Wattributes] 341 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:355:1: warning: 'dllexport' attribute ignored [-Wattributes] 355 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:365:1: warning: 'dllexport' attribute ignored [-Wattributes] 365 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:379:1: warning: 'dllexport' attribute ignored [-Wattributes] 379 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:392:1: warning: 'dllexport' attribute ignored [-Wattributes] 392 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:406:1: warning: 'dllexport' attribute ignored [-Wattributes] 406 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:418:1: warning: 'dllexport' attribute ignored [-Wattributes] 418 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:429:1: warning: 'dllexport' attribute ignored [-Wattributes] 429 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:442:1: warning: 'dllexport' attribute ignored [-Wattributes] 442 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:456:1: warning: 'dllexport' attribute ignored [-Wattributes] 456 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:468:1: warning: 'dllexport' attribute ignored [-Wattributes] 468 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:481:1: warning: 'dllexport' attribute ignored [-Wattributes] 481 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:494:1: warning: 'dllexport' attribute ignored [-Wattributes] 494 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:506:1: warning: 'dllexport' attribute ignored [-Wattributes] 506 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:518:1: warning: 'dllexport' attribute ignored [-Wattributes] 518 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:530:1: warning: 'dllexport' attribute ignored [-Wattributes] 530 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:547:1: warning: 'dllexport' attribute ignored [-Wattributes] 547 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:562:1: warning: 'dllexport' attribute ignored [-Wattributes] 562 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:575:1: warning: 'dllexport' attribute ignored [-Wattributes] 575 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:587:1: warning: 'dllexport' attribute ignored [-Wattributes] 587 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:599:1: warning: 'dllexport' attribute ignored [-Wattributes] 599 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:613:1: warning: 'dllexport' attribute ignored [-Wattributes] 613 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:629:1: warning: 'dllexport' attribute ignored [-Wattributes] 629 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:644:1: warning: 'dllexport' attribute ignored [-Wattributes] 644 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:657:1: warning: 'dllexport' attribute ignored [-Wattributes] 657 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:669:1: warning: 'dllexport' attribute ignored [-Wattributes] 669 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:681:1: warning: 'dllexport' attribute ignored [-Wattributes] 681 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:695:1: warning: 'dllexport' attribute ignored [-Wattributes] 695 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:712:1: warning: 'dllexport' attribute ignored [-Wattributes] 712 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:726:1: warning: 'dllexport' attribute ignored [-Wattributes] 726 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:740:1: warning: 'dllexport' attribute ignored [-Wattributes] 740 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:754:1: warning: 'dllexport' attribute ignored [-Wattributes] 754 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:771:1: warning: 'dllexport' attribute ignored [-Wattributes] 771 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:800:1: warning: 'dllexport' attribute ignored [-Wattributes] 800 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:814:1: warning: 'dllexport' attribute ignored [-Wattributes] 814 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:831:1: warning: 'dllexport' attribute ignored [-Wattributes] 831 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:846:1: warning: 'dllexport' attribute ignored [-Wattributes] 846 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:861:1: warning: 'dllexport' attribute ignored [-Wattributes] 861 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:872:1: warning: 'dllexport' attribute ignored [-Wattributes] 872 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:886:1: warning: 'dllexport' attribute ignored [-Wattributes] 886 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:896:1: warning: 'dllexport' attribute ignored [-Wattributes] 896 | ); | ^ oasis/../oasis/../oasis/pkcs11f.h:911:1: warning: 'dllexport' attribute ignored [-Wattributes] 911 | ); | ^ /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../lib/libcygwin.a(libcmain.o): in function 'main': /usr/src/debug/cygwin-3.3.5-1/winsup/cygwin/lib/libcmain.c:37: undefined reference to 'WinMain' collect2: error: ld returned 1 exit status

What could be wrong with my manipulation ?

@E-genin
Copy link

E-genin commented Nov 10, 2022

Update : I could not make any progress using the command line (the warnings remained and the dll was not generated).
I created a dll project in codeblocks IDE and built it there, the warnings remained the same but somehow the dll is now genereated.

@bentonstark
Copy link
Owner

You have redefinitions that you need to fix.

In file included from p11hsm.cpp:22: p11hsm.h:35: warning: "EXTERN_C" redefined 35 | #define EXTERN_C extern "C" __declspec(dllexport) | In file included from /usr/include/w32api/minwindef.h:163, from /usr/include/w32api/windef.h:9, from /usr/include/w32api/windows.h:69, from p11hsm.h:28, from p11hsm.cpp:22: /usr/include/w32api/winnt.h:423: note: this is the location of the previous definition 423 | #define EXTERN_C extern "C" | In file included from oasis/../oasis/pkcs11.h:263, from oasis/cryptoki.h:78, from mechtype.h:15, from p11hsm.cpp:23:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants