Project

General

Profile

I want to create a project that would build a DLL, for testing the wtisapi connector library, but I'm having problems

Added by Osman Zakir almost 8 years ago

As the title says, I want to test out the wtisapi connector and am trying to build a DLL project for it on Visual Studio (2017), but I'm having problems. I got a whole bunch of linker errors and I don't know how to fix them. The .txt file attached to this message shows my build output, so please look at it.

The DLL project had a lot of default files, but the only ones I edited I'm also attaching to this post. The other files are pch.h, pch.cpp, dllmain.h, and targetver.h, all of which I just left alone because I don't know what to do with them.

The Boost and Wt libraries I got linker errors for I'm sure I already to the linker library path and linker input. So I don't know what the problem is.


Replies (22)

RE: I want to create a project that would build a DLL, for testing the wtisapi connector library, but I'm having problems - Added by Osman Zakir almost 8 years ago

I really would like some help here. Please. I'm also installing an Ubuntu ISO on VirtualBox so that I can try using the FastCGI protocol connector library there, but I also want to build the DLL extension for ISAPI as well. I've asked on MSDN how to get the tools needed for building an ISAPI Extension, too. In the meantime, I'm also attaching Project File that I tried to build the DLL extension with. It has to be opened with Visual Studio 2017, by the way (I used the Community edition).

RE: I want to create a project that would build a DLL, for testing the wtisapi connector library, but I'm having problems - Added by Wim Dumon almost 8 years ago

Hey,

You seem to be forgetting some libraries in your link command.

At first I'm surprised to see Wt::WRun, Wt::WServer::stop, and especially Wt::isapi::`anonymous namespace'::GetCurrentModule(void), since these functions should be included in wtisapi.lib itself. Could this be a misbuild of your wtisapi library?

GetModuleHandle is in kernel32.lib. Add it to your link list.

d2i_X509_bio referenced are related to openssl. Add both openssl libraries to your link list. (ssleay32.lib, libeay32.lib or similar)

Wim.

RE: I want to create a project that would build a DLL, for testing the wtisapi connector library, but I'm having problems - Added by Osman Zakir almost 8 years ago

I thought it said on Wt's support site that I didn't have to make any changes to my normal C Wt code when using the wtisapi library. So I made no changes to the code itself. I don't know what you mean about what you said concerning "Wt::WRun, Wt::WServer::stop, and especially Wt::isapi::`anonymous namespace'::GetCurrentModule(void)", either.

And I'm really trying to build wtisapi library user app. But of course I don't know what libraries to link with aside from some Boost dependencies, wt.lib/wtd.lib, and wtisapi.lib/wtisapid.lib. And why am I getting linker errors about Boost when I've correctly specified where it is under linker options?

If FastCGI shouldn't be used at all, on any platform, shouldn't we get some other protocol added to Wt? The built-in httpd doesn't support multiple sessions, so of course we can't use that on anything other than debugging, and the ISAPI connector apps are hard to set-up as far as I can see. We need an alternative. Shouldn't you guys consider adding support for one of the better protocols, for both Apache and IIS? Just a suggestion (please don't think I'm trying to dictate to you what to do or anything).

I also can't build any of the Wt user apps I was already able to build before. Really, what happened?

RE: I want to create a project that would build a DLL, for testing the wtisapi connector library, but I'm having problems - Added by Wim Dumon almost 8 years ago

Hey Osman,

The built-in httpd doesn't support multiple sessions

The built-in httpd is a multithreaded, fully asynchronous webserver which has no limit to the amount of sessions it can support, other than wat is implied by your hardware (amount of RAM, CPU power, ...). It is the preferred method of deploying in production for most of our users.

Where did you learn that it does not support multiple sessions?

Best regards,

Wim.

RE: I want to create a project that would build a DLL, for testing the wtisapi connector library, but I'm having problems - Added by Osman Zakir almost 8 years ago

I read it on the Wt support site. I don't remember the exact page. If you say it can support multi-threading and has no limit to the number of sessions it can support, I'll take your word for it.

I still want to try to build with wtisapi.lib, though, and I also need to know why my linker can't find Boost libraries. I did build Boost 1.64 from source, so maybe I should use that instead of the one that comes with Wt.

RE: I want to create a project that would build a DLL, for testing the wtisapi connector library, but I'm having problems - Added by Osman Zakir almost 8 years ago

Sorry for the triple post, but I need to add an update.

Just now, I enabled some additional IIS features like ISAPI support and such, and then I tried to build the "Hello World" example app with the wtisapi connector library again. It was failing before, too, but now it failed some additional linker errors that weren't there before (or at least, I hadn't noticed them).

The errors are as follows (6 errors):

1>hello.obj : error LNK2019: unresolved external symbol "_declspec(dllimport) intcdecl Wt::WRun(int,char * *,class boost::function<class Wt::WApplication*cdecl(class Wt::WEnvironment const &)>)\" (imp?WRunWt@YAHHPEAPEADV?$function$$A6APEAVWApplication@Wt@AEBVWEnvironment2@Zboost@Z) referenced in function main
1>wtisapid.lib(Server.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl Wt::WServer::stop(void)" (__imp_?stop
WServerWt@QEAAXXZ) referenced in function "public: void __cdecl Wt::isapi::IsapiServer::shutdown(void)\" (?shutdownIsapiServer@isapi@Wt@QEAAXXZ)

1>wtisapid.lib(IsapiRequest.obj) : error LNK2019: unresolved external symbol BIO_free_all referenced in function "struct x509_st * __cdecl `anonymous namespace'::convertCertContext(struct _CERT_CONTEXT const &)" (?convertCertContext?A0x447ef283@YAPEAUx509_stAEBU_CERT_CONTEXTZ)
1>wtisapid.lib(IsapiRequest.obj) : error LNK2019: unresolved external symbol BIO_new_mem_buf referenced in function "struct x509_st * __cdecl anonymous namespace'::convertCertContext(struct _CERT_CONTEXT const &)" (?convertCertContext?A0x447ef283 YAPEAUx509_st``AEBU_CERT_CONTEXT Z)
1>wtisapid.lib(IsapiRequest.obj) : error LNK2019: unresolved external symbol d2i_X509_bio referenced in function "struct x509_st * __cdecl
anonymous namespace'::convertCertContext(struct _CERT_CONTEXT const &)" (?convertCertContext?A0x447ef283YAPEAUx509_stAEBU_CERT_CONTEXT``Z)
1>wtisapid.lib(IsapiRequest.obj) : error LNK2019: unresolved external symbol X509_free referenced in function "public: virtual class Wt::WSslInfo * __cdecl Wt::isapi::IsapiRequest::sslInfo(void)const " (?sslInfo
IsapiRequestisapi@Wt@UEBAPEAVWSslInfo3XZ)

Any help would be appreciated.

Another user told me to do something in IIS itself to make my ISAPI extension app work. Do I have to do something there to let the app build successfully as well, by some chance? I'll ask him that, too. But that very last linker error seems to be referencing an SSL function. Is it a function from the OpenSSL library? I don't have any functions from that library being called in my code, though (it's the "Hello World" example that ships with the Wt distribution, and I didn't make any changes to it).

RE: I want to create a project that would build a DLL, for testing the wtisapi connector library, but I'm having problems - Added by Wim Dumon almost 8 years ago

Do you link against wtd.lib?

All other methods are indeed missing openssl libraries.

Since wtisapid.lib is a static libary (and has to be a static library), we can't link it already to its dependend libraries. So indeed, when you link your hello.dll, you'll have to specify the libraryes that wtisapid.dll depends on as well.

No, configuring IIS has no impact whatsoever on link errors.

Wim.

RE: I want to create a project that would build a DLL, for testing the wtisapi connector library, but I'm having problems - Added by Osman Zakir almost 8 years ago

I do link against wt.lib/wtd.lib as needed each time. And I tried linking against OpenSSL libraries before, but it gave me other errors (a total of 47 Linker errors).

My OpenSSL libraries are named as follows, by the way: libcrypto64MD.lib, libcrypto64MDd.lib, libcrypto64MT.lib, libcrypto64MTd.lib, libssl64MD.lib, libssl64MDd.lib, libssl64MT.lib, and libssl64MTd.lib.

I don't know which ones to link against. And these are just the ones in the VC subfolder in C:\OpenSSL-Win64\lib\VC, by the way (there are other .lib files outside the VC folder (capi.lib, dasync.lib, libcrypto.lib, libsll.lib, openssl.lib, ossltest.lib, padlock.lib)). I'm looking at the recent attempt I made with the Release configuration, hello_test.sln which had previously been built successfully with wthttp.lib. I'll try it again and paste the errors here. I've also attached the relevant .cpp, .vcxproj and .sln files to this post.

I had only 3 linker errors this time, and I linked against libcrypto64MT.lib and libssl64MT.lib.

1>hello.obj : error LNK2001: unresolved external symbol \"_declspec(dllimport) intcdecl Wt::WRun(int,char * *,class boost::function<class Wt::WApplication*cdecl(class Wt::WEnvironment const &)>)\" (imp?WRunWt@YAHHPEAPEADV?$function$$A6APEAVWApplication@Wt@AEBVWEnvironment2@Zboost@Z)
1>wtisapi.lib(Server.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __cdecl Wt::WServer::stop(void)" (__imp_?stop
WServerWt@QEAAXXZ)

1>C:\Users\Osman\programming\visual_studio_2017\Projects\Wt\hello_test\x64\Release\hello_test.dll : fatal error LNK1120: 2 unresolved externals

I linked against the correct OpenSSL libraries this time, right? There's a "static" folder which I guess has the static libraries, but I don't think I should link against those (should I?).

What are the wtisapi.lib dependencies, and which of them am I not referencing yet?

Thanks in advance for any help.

RE: I want to create a project that would build a DLL, for testing the wtisapi connector library, but I'm having problems - Added by Osman Zakir almost 8 years ago

And I downloaded the Wt binary distributions, so if there's a miss-build in wtisapi.lib, it's not my fault. Thank you.

RE: I want to create a project that would build a DLL, for testing the wtisapi connector library, but I'm having problems - Added by Osman Zakir almost 8 years ago

I'm attaching by build log to this post (the one created by the IDE itself). Please look at it.

hello_test.log (52.5 KB) hello_test.log Build log

RE: I want to create a project that would build a DLL, for testing the wtisapi connector library, but I'm having problems - Added by Osman Zakir almost 8 years ago

Note: When you open the attached .sln and .vcxproj files, be sure to set the configuration to Release x64 (the configuration I was using). Otherwise, the project will be set to building a .exe file which isn't one of the settings I was using. Setting it to "Release x64" also makes the other settings go back to the ones I'd used on this project. I don't know what happened.

RE: I want to create a project that would build a DLL, for testing the wtisapi connector library, but I'm having problems - Added by Wim Dumon almost 8 years ago

Osman,

We'll look into this. This may indeed be a problem with the binary build.

Wim.

RE: I want to create a project that would build a DLL, for testing the wtisapi connector library, but I'm having problems - Added by Roel Standaert almost 8 years ago

Hi,

I've looked into it, and while our binary build does have issues, it can be made to work.

While it's true that our binary builds add __declspec(ddlimport) to WRun, WServer::stop(), etc., this should only cause warning messages when linking, not errors.

You will have to make sure that you define WTHTTP_STATIC when using our binary builds, though, as stated on this wiki page: http://redmine.webtoolkit.eu/projects/wt/wiki/ISAPI_on_Microsoft_IIS

You will then run into errors about undefined symbols related to OpenSSL, though. This is a problem with our binary builds, because we don't include the .lib files for OpenSSL. I could still successfully build a test application using the lib files from here: https://indy.fulgan.com/SSL/LinkLibs/openssl-1.0.2k-x64_86-win64_LinkLibs.zip.

Following those steps, I managed to make a working test project based on our binary builds of Wt.

We'll make sure that the OpenSSL .lib files are included in future builds, and that wtisapi.lib is built correctly.

Regards,

Roel

RE: I want to create a project that would build a DLL, for testing the wtisapi connector library, but I'm having problems - Added by Osman Zakir almost 8 years ago

I did add libs from OpenSSL, though. I guess they could be the wrong ones, though?

Anyway, yeah, OpenSSL being included in future binary builds would be a great help. At least don't make it a requirement for CMake builds. For CMake, Boost being the only required dependency seems better.

The OpenSSL libs I got when I downloaded the binary builds from the OpenSSL website are different from the ones you just gave me. Why is that? I'll try building it again by following those steps and then get back to you.

RE: I want to create a project that would build a DLL, for testing the wtisapi connector library, but I'm having problems - Added by Osman Zakir almost 8 years ago

Never mind about the .def files (I just put the .def files with the .lib files without saying their names anywhere). It worked for me, with just one Linker warning on wtisapi.lib:

1>wtisapi.lib(Server.obj) : warning LNK4049: locally defined symbol ?stopWServer@Wt@QEAAXXZ (public: void __cdecl Wt::WServer::stop(void)) imported

That's the warning you meant, right? Anyway, I need to configure my IIS to use the built extension DLL now. Thanks for the help.

RE: I want to create a project that would build a DLL, for testing the wtisapi connector library, but I'm having problems - Added by Osman Zakir almost 8 years ago

I've added the DLL to the "hello" example directory and added that directory to IIS, and I also added it to CGI and ISAPI Restrictions, but I can't access it on my browser. I'm pretty sure that the IIS server is started. How do I "run" the DLL?

RE: I want to create a project that would build a DLL, for testing the wtisapi connector library, but I'm having problems - Added by Roel Standaert almost 8 years ago

What kind of error are you getting? If you're getting a 403, that could mean that IIS doesn't have access to that directory. If you're getting a 404, it's possible that one of the DLLs isn't found. You'll need to have the bin directory of Wt on your Path, or copy the DLLs next to the one you're trying to run.

Regards,

Roel

RE: I want to create a project that would build a DLL, for testing the wtisapi connector library, but I'm having problems - Added by Osman Zakir almost 8 years ago

It was a 404-Not Found error before, but now it's 500-Internal Server Error.

Module

   IsapiModule

*Notification

*>    ExecuteRequestHandler

*Handler

*>    ISAPI-dll

*Error Code

*>    0x800700c1

*Requested URL

*>    http://localhost:80/Wt_dir/hello/hello_test.dll

*Physical Path

*>    C:\Program Files\Wt\Wt-3.3.7-msvs2015-Windows-x64-SDK\lib\Wt\examples\hello\hello_test.dll

*Logon Method

*>    Anonymous

*Logon User

*>    Anonymous

That's the message I got on the default IIS error page, under "Detailed Error Information".

One thing I noticed is that my IIS Manager doesn't have a path set for "ExtionlessUrlHandler-ISAPI" (just the wildcard "*.".

RE: I want to create a project that would build a DLL, for testing the wtisapi connector library, but I'm having problems - Added by Osman Zakir almost 8 years ago

Update: Okay, I got rid of all HTTP response errors, but now I can't figure out how to run the extension. When I click on hello_test.dll, it downloads it to my computer. Then I get a dialogue box popup that says that the .dll doesn't have any programs associated with and that it can't start. So how do I run it? And is it possible to associate ISAPI with it so that ISAPI itself can run it?

RE: I want to create a project that would build a DLL, for testing the wtisapi connector library, but I'm having problems - Added by Wim Dumon almost 8 years ago

Hey Osman,

That's because IIS is somehow not configured to execute the dll as isapi extension. Please refer to our wiki page on isapi and IIS, which contains all settings you have to change from a default IIS configuration to make ISAPI work for Wt. If your IIS configuration is different or more complex, the documentation of IIS should provide you the additional information you need.

Unfortunately, IIS setup is not very forgiving nor very informative with respect to misconfiguration.

Best regards,

Wim.

RE: I want to create a project that would build a DLL, for testing the wtisapi connector library, but I'm having problems - Added by Osman Zakir almost 8 years ago

I did follow the directions on the Wiki page. I added the ISAPI handler to my DLL, too. So why won't it work?

    (1-22/22)