Linking problems in MSVC++
Don Payette
payettedon at gmail.com
Fri Sep 8 15:25:49 UTC 2023
Well, very interesting. This is something called name mangling.
The way you keep the mangling from happening is by adding:
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
around the entry points. Well, ssl.h has this code in there so I shouldn't
be having
this problem.
I also tried this in my Socket.cpp file:
extern "C" {
#include <openssl/ssl.h>
#include <openssl/err.h>
}
It didn't help. I'm still getting the linker errors showing
entrypoints with "_" on the front.
Any idea what might be going on?
Don Payette
(cell) 479-216-6320 <(479)%20216-6320>
On Wed, Sep 6, 2023 at 8:22 AM Don Payette <payettedon at gmail.com> wrote:
> Well, the linker is giving me this error, plus other similar errors:
>
> Error LNK2019 unresolved external symbol _SSL_CTX_new referenced in
> function ...
>
> My code is calling SSL_CTX_new, so it appears something is adding an
> underscore on the front.
> I looked in libssl.def and SSL_CTX_new is there, but not _SSL_CTX_new.
> Anybody know where
> the underscore is coming from?
>
>
> Don Payette
> (cell) 479-216-6320 <(479)%20216-6320>
>
>
> On Thu, Aug 31, 2023 at 11:53 AM Kenneth Porter <shiva at sewingwitch.com>
> wrote:
>
>> On 8/31/2023 8:24 AM, Don Payette wrote:
>>
>> I'm using Microsoft Visual Studio, so no command line.
>> In the linker settings there is an External Dependencies. I added
>> libcrypto.lib and libssl.lb.
>> We'll see what happens.
>>
>> Open the project configuration, go to Configuration Properties | Linker |
>> Command Line, and you can copy and paste the arguments that the IDE will
>> pass to the linker. (There's a similar feature under C/C++ in that dialog
>> for the command line compiler.) If it says "different options", you need to
>> use the drop-down menus at the top of the dialog to select a specific
>> configuration (like Debug and x64) to see the command line for that
>> configuration.
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mta.openssl.org/pipermail/openssl-users/attachments/20230908/0a5d97d9/attachment.htm>
More information about the openssl-users
mailing list