Click here to Skip to main content
15,898,134 members
Articles / Programming Languages / C++

Thunking in Win32: Simplifying Callbacks to Non-static Member Functions

Rate me:
Please Sign up or sign in to vote.
4.33/5 (32 votes)
22 Dec 2006Apache10 min read 119.9K   673   60  
A quick introduction to thunking, as well as a demonstration of a simple library which does the work for us.

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Thunk32Demo", "Thunk32Demo\Thunk32Demo.vcproj", "{262DC058-1A21-4C3C-A5F6-FC60B091B922}"
	ProjectSection(ProjectDependencies) = postProject
		{D303A9EB-08A2-4671-BA79-47F834B39911} = {D303A9EB-08A2-4671-BA79-47F834B39911}
	EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Thunk32", "Thunk32\Thunk32.vcproj", "{D303A9EB-08A2-4671-BA79-47F834B39911}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Win32 = Debug|Win32
		Release|Win32 = Release|Win32
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{262DC058-1A21-4C3C-A5F6-FC60B091B922}.Debug|Win32.ActiveCfg = Debug|Win32
		{262DC058-1A21-4C3C-A5F6-FC60B091B922}.Debug|Win32.Build.0 = Debug|Win32
		{262DC058-1A21-4C3C-A5F6-FC60B091B922}.Release|Win32.ActiveCfg = Release|Win32
		{262DC058-1A21-4C3C-A5F6-FC60B091B922}.Release|Win32.Build.0 = Release|Win32
		{D303A9EB-08A2-4671-BA79-47F834B39911}.Debug|Win32.ActiveCfg = Debug|Win32
		{D303A9EB-08A2-4671-BA79-47F834B39911}.Debug|Win32.Build.0 = Debug|Win32
		{D303A9EB-08A2-4671-BA79-47F834B39911}.Release|Win32.ActiveCfg = Release|Win32
		{D303A9EB-08A2-4671-BA79-47F834B39911}.Release|Win32.Build.0 = Release|Win32
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Apache License, Version 2.0


Written By
Software Developer
Norway Norway
My name is Einar Otto Stangvik, and I'm a programmer based in Oslo, Norway. I mainly develop applications and software architectures targetting C++ on the Windows platform, but I have also got experience doing the same on Unix and Linux. The last few years I've used C# a lot, but native C++ is still my main focus.


As of July 2008, I'm a Microsoft MVP for Visual C++.


Follow me on Twitter: @einaros
My code blog: einaros.blogspot.com
My site: www.indev.no

Comments and Discussions