Creating the DLL in Windows using Visual C++ 2010 Express

1,182 views
Skip to first unread message

scjohn

unread,
Dec 8, 2010, 3:15:00 PM12/8/10
to firebreath-dev
Just a FYI for those that are using Microsoft Visual C++ 2010 Express
and following the Windows Video Tutorial.

In addition to following the instructions at
http://www.firebreath.org/display/documentation/Building+with+Visual+Studio+Express#
I also had to add

#pragma comment(lib, "atlthunk.lib")

To the top of FireBreathWin.cpp

Without this pragma statement I would get the following error during
Build. (Repeats a few of times).

error LNK2019: unresolved external symbol "void __stdcall
ATL::__FreeStdCallThunk

John

Richard Bateman

unread,
Dec 8, 2010, 3:21:13 PM12/8/10
to firebre...@googlegroups.com

Thanks for the heads up; this is all still a little experimental. We'll have to see if we can find a way to make that automatic...

Richard

Neil Griffiths

unread,
Dec 8, 2010, 3:37:41 PM12/8/10
to firebre...@googlegroups.com
Would you have still gotten it if you had the Platform SDK installed?

Just something to ponder...

Neil

Richard Bateman

unread,
Dec 8, 2010, 3:48:27 PM12/8/10
to firebre...@googlegroups.com

If he didn't have the platform SDK (or something similar) installed, I assume he wouldn't have had the ATL header files or libraries...

no?

Richard

scjohn

unread,
Dec 8, 2010, 4:14:12 PM12/8/10
to firebreath-dev
Oh there is a good chance I screwed something up.. I selected only
the "Build Environments" from the "Microsoft Windows Drivers Kit
7.1.0.7600", but the rest of the options seems to be samples, help and
testing stuff.

The fix from this morning in axutil.h did not work for me, I just
ended up commenting out the #if so that m_hkey is always defined. If
I can do anything to help with either of these issues let em know I
will be glad to try fixes.

I also had trouble loading another library that I needed and the same
pragma solution cleaned that library up as well. However I had
trouble getting that library to actually load in the browser, I added
an entry to the "Additional Dependencies" for the project (I just put
the name of the .lib file) and as of now I am able to build a plugin
and get it to allow me to talk to a USB device via JavaScript. So I
feel I am on my way.

Anyway, thanks for the project, I have been trying to figure this
out for a while and a few hours with FireBreath got me to a pretty
good point.

John

On Dec 8, 3:48 pm, Richard Bateman <rich...@batemansr.us> wrote:
> If he didn't have the platform SDK (or something similar) installed, I assume he wouldn't have had the ATL header files or libraries...
>
> no?
>
> Richard
>
> On Dec 8, 2010, at 1:37 PM, Neil Griffiths wrote:
>
>
>
>
>
>
>
> > Would you have still gotten it if you had the Platform SDK installed?
>
> > Just something to ponder...
>
> > Neil
>
> > On Wed, Dec 8, 2010 at 3:15 PM, scjohn <goclem...@gmail.com> wrote:
> > Just a FYI for those that are using Microsoft Visual C++ 2010 Express
> > and following the Windows Video Tutorial.
>
> > In addition to following the instructions at
> >http://www.firebreath.org/display/documentation/Building+with+Visual+...

Neil Griffiths

unread,
Dec 8, 2010, 4:14:43 PM12/8/10
to firebre...@googlegroups.com
That's a good question - I have no idea having never used Visual Studio Express myself.

I believe that ATL 7.1 is distributed along with the Windows Driver Kit which may be of interest to some people. Though that doesn't address *this* issue. May just be a case of adding atlthunk.lib as a dependency in the generated projectDef.cmake files?

Neil

Neil Griffiths

unread,
Dec 8, 2010, 4:16:34 PM12/8/10
to firebre...@googlegroups.com
Please don't add dependencies that way because the .sln and .vcproj file is generated - and if you have to regenerate it again for any reason then you'll lose those changes.

I'd recommend following the instructions on this link to get your dependencies working correctly:


Good luck!

Richard Bateman

unread,
Dec 9, 2010, 2:02:40 AM12/9/10
to firebre...@googlegroups.com

if someone wants to try to fix it, we need to figure out what the correct value of _ATL_VER should be so that it compiles it in correctly; it shouldn't be hard to figure out. However, I'm just going into finals week on the worst semester of my life so far (I've been at school 'til 11pm almost every night for the last week and a half) and so I'm not going to be able to track this down for at least a couple of weeks.

Patches, pull requests, etc all welcome. Let's try to fix this properly so that FireBreath can be built with all free tools!

Richard

scjohn

unread,
Dec 9, 2010, 10:07:42 AM12/9/10
to firebreath-dev
Yea, I knew I was doing it wrong, just wanted to get it running
first.

I am first trying to get the MFC and ATL include directories into
projectDef.cmake. Adding these lines appears to add the correct
"Additional Include Directories" to my 'main' Project, however I can't
seem to find out how to add these includes (using cmake) to the
_ActiveXPlugin, _NpapiPlugin, etc. Any ideas?

# include the atl and mfc files.
include_directories(c:/WinDDK/7600.16385.1/inc/atl71)
include_directories(c:/WinDDK/7600.16385.1/inc/mfc42)

John

Neil Griffiths

unread,
Dec 9, 2010, 10:49:09 AM12/9/10
to firebre...@googlegroups.com
Yes, delete your build directory and regenerate it using the prep script. The one issue I constantly have with CMake is it doesn't seem to pick up changes I make to include directories once I've generated a build folder.

Neil

Richard Bateman

unread,
Dec 9, 2010, 11:12:42 AM12/9/10
to firebre...@googlegroups.com

You really want to configure those directories in the global visual studio settings, the global include and lib dirs, not in the project itself.

If you wanted to do it in the project itself, you're going to have to do a lot of additional work.  The easiest way would probably be to put the include_directories(..) call in the root firebreath cmakelists.txt file.  However... don't do this.  it's not worth the trouble when there is an easier way.


You basically want to set the include dirs on the root property sheet which all projects will inherit the values from.

Richard

scjohn

unread,
Dec 9, 2010, 12:54:53 PM12/9/10
to firebreath-dev
Ok, for those following along I think I pretty much have this worked
out.

Steps for building with Microsoft Visual c++ 2010 Express

Follow steps 1-3 from http://www.firebreath.org/display/documentation/Building+with+Visual+Studio+Express

Step 4 needs to be updated with a 2010 section

For VS Express 2010:

1. Open your FireBreath project
a. File -> Open -> Project/Soltion
b.build/FireBreath.sln (Wherever your project file is located)
2. Go to View -> Property Manager
3. Expand ALL_BUILD -> Debug | Win 32
4. Right click on Microsoft.Cpp.Win32.user -> Properties
5. Common Properties -> VC++ Directories
6. Add (WDK DIR)\inc\atl71 to include paths
7. Add (WDK DIR)\inc\mfc42 to include paths
a. It may be neccesary for the mfc42 path to be after the ATL
path and both should be at the end of the list.
8. Add (WDK DIR)\lib\atl\i386 to the library paths
9. It may be necessary to add 'target_link_libraries(${PLUGIN_NAME}
"atlthunk.lib")' to the bottom of the projects projectDef.cmake

These steps should only need to be done once. From there I can just
right click -> build and get a dll...

Also a note for the Using Libraries page, the library stuff cannot go
at the top of the file, it worked for me if I stuck it at the
bottom. If you put it at the top of the file you get this error
message 'Cannot specify link libraries for target "MyProjectTest"
which is not built by this project.'

I have also found that adding this
'target_link_libraries(${PLUGIN_NAME} "atlthunk.lib")'
to my project's projectDef.cmake allows the project to compile without
the pragma statement from my original post. I just put it at the
bottom of the cmake file.

If I can do anything to help with the _ATL_VER problem please let me
know.

John

Richard Bateman

unread,
Dec 9, 2010, 1:44:17 PM12/9/10
to firebre...@googlegroups.com

Great! The awesome thing about the web page is that anyone can update it... just create an account, edit the page, and add the info.

If you could do that, that would be a huge help!

That goes for everyone; the best way we'll improve our documentation is for all of you to update the wiki when we answer questions so that the next person can find it faster (or we can just refer back to it). It's difficult for us because we're short on time.

Richard

Reply all
Reply to author
Forward
0 new messages