Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MFC VC++
Hi!
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 20:17pm

1 solution

Rate this: bad
good
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.
  Permalink  
Comments
Sameer_awana at 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 at 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 at 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 at 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 at 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
0 Marcin Kozub 275
1 OriginalGriff 249
2 Sergey Alexandrovich Kryukov 215
3 Praneet Nadkar 197
4 Richard MacCutchan 182
0 OriginalGriff 8,048
1 Sergey Alexandrovich Kryukov 7,287
2 DamithSL 5,614
3 Manas Bhardwaj 4,986
4 Maciej Los 4,910


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 20 Feb 2013
Copyright © CodeProject, 1999-2014
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