Netdiver030
8th May 2006 18:45 UTC
exDll with MFC Support
Has anyone a template that can be linked? (XP & VC7)
I stumbled around for a long time and read a lot of threads.
C++ is not the issue, but using normal Mfc functions like registry and other bumpf behind it would be a nice feature.
NetDiver030
kichik
8th May 2006 20:16 UTC
Doesn't creating MFC DLL with the VC wizards work? That should be enough, I think. If not, probably some MFC initialization functions must be called.
But I'd highly recommend you don't create plug-ins using MFC. Using MFC to create plug-ins would require any installer using them to install the MFC runtimes before it could even start running.
Joel
8th May 2006 20:38 UTC
unless you linked statically the runtimes :\
Netdiver030
9th May 2006 06:04 UTC
Unfortunately the normal VC wizard MFC Dll as a PlugIn Dll does not work.
Only the calling of my MfcStuffDll functions via System::Call works fine. But as far as I get it this requires that my MfcStuffDll is installed first.
Or is there a way to use my dll from within the installer archive? - I haven't look too closely at the usage of temporary files. Maybe that way.
Or has anyone an exDll example with mfc support?
(static linking. Currently there is enough discspace to waste for this project :-) )
kichik
9th May 2006 13:05 UTC
How do you pass the stack pointer and the variables pointer using System::Call? Have you used the correct function parameters for the functions you wish the export? What about the calling convention?
Netdiver030
9th May 2006 14:26 UTC
Thanks for your support so far.
Your hint with the system::call function was very helpful.
I found a workaround which is fine for me because my software requires administrator priviliges anyway.
I just stuffed all my MFC code in an ordinary MFC Dll.
And in the init part of my installer script I install this dll in the system32 folder. Than I call my mfc functions and retrieve my system analysis and after that I remove the temporarly installed Dll from system32 and continue with the installation of the software.
Works fine - but like I mentioned only for installations with administrator prviliges.
Btw. I tried the normal calling convention from the exDll example:
MyDll:MyFunction ...
on the MFC Dll.
Now I use the
System::Call "MyDll::MyCheck()i().r0"
to find out if some things.
kichik
9th May 2006 14:43 UTC
That's not the calling convention I'm talking about. I'm talking about __stdcall and __cdecl. I'm talking about how you define the function in your DLL. Its header should look exactly like the functions in exdll.c, except the name. If not, you won't be able to call them the script like a normal plug-in and you'll have to use the System plug-in. Judging by the System call that does work for you, you've got the wrong function header.