Old 8th May 2006, 17:45   #1
Netdiver030
Junior Member
 
Join Date: May 2006
Posts: 3
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
Netdiver030 is offline   Reply With Quote
Old 8th May 2006, 19:16   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 8th May 2006, 19:38   #3
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
unless you linked statically the runtimes :\


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 9th May 2006, 05:04   #4
Netdiver030
Junior Member
 
Join Date: May 2006
Posts: 3
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 :-) )
Netdiver030 is offline   Reply With Quote
Old 9th May 2006, 12:05   #5
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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?

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 9th May 2006, 13:26   #6
Netdiver030
Junior Member
 
Join Date: May 2006
Posts: 3
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.
Netdiver030 is offline   Reply With Quote
Old 9th May 2006, 13:43   #7
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump