Click here to Skip to main content
13,045,379 members (93,018 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I want to write my own dll for my MFC application common function,which are always used; so can I create that dll in win32 or in mfc dll mode?
Please answer!!
Thanks in advance!!
Posted 19-Feb-13 19:17pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Your question is not clear, but I'll attempt to answer.

You can create a DLL which does not include any MFC linkage (in or out).

You can create a DLL which has MFC linkage and may or may not expose some MFC and/or MFC-derived classes.

In each of the above cases, your DLL(s) can be linked to from an executable with or without MFC linkage or another DLL with or without MFC linkage.
Sameer_awana 20-Feb-13 8:57am
Fine!! I create my own dll with using Win32 Api's so I can link that dll to my mfc application
Sameer_awana 22-Feb-13 7:14am
I create my own DLL by using WIN32 API's and I want link that dll in my MFC Dialogue based application,so how to do that?
H.Brydon 22-Feb-13 10:29am
I will assume that your mfc dll is "mm.dll", defined in "mm.vcxproj" and the plain dll is "xx.dll", defined by "xx.vcxproj", and you want to link mm.dll to xx.dll (your request is vague). Your solution file should include both of these. In visual studio, go to the solution explorer, right click "mm" project, go to "Linker General" view. "Additional Library Directories" should say "$(SolutionDir)$(Configuration)\". Go to "Linker Input" and "Additional Dependencies" should include "xx.lib" in the semicolon-separated list.
Sameer_awana 23-Feb-13 2:42am
ok,thank you it works fine for simple functions which return integer and float values,but in my mfc application,I want to return a handle of device and that function is common to all child windows in my application, so how to declare & define that function in c file of DLL?
H.Brydon 23-Feb-13 18:25pm
On Win32, a HANDLE is really just an int (32 bits), so you should be able to just cast it to an int when sending it over to the "C" world and cast it back to a HANDLE when passing it back to MFC.

Not sure about Win64 ... check the docs.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 20 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100