Setup.dll => too big, why?

J

James Hetfield

Hello

I'm new to C++.

I am trying to create a setup.dll in VS 2005. The samples in the SDK didnt
work for me:
=> removed the CAB-Project in it, then tried to build the DLL, I got:
1>------ Skipped Build: Project: SetupDLL ------
1>
========== Build: 0 succeeded or up-to-date, 0 failed, 1 skipped ==========

I dont know why, tried from Smartphone WM 5 and PPC WM 5... the same...

So I have created an own project:

1. New Project = > Visual C++ => Smart Device => MFC Smart Device DLL
2. then I proceed like this here:
http://www.pocketpcdn.com/articles/setupdll.html
3. I added in the codeINSTALL_EXIT-Section:
between AFX_MANAGE_STATE(AfxGetStaticModuleState());
and
return codeINSTALL_EXIT_DONE;
the following:
PROCESS_INFORMATION pi = {0};
CreateProcess(TEXT("\\My Documents\\myapp.exe"), TEXT(""), NULL, NULL,
NULL, 0, NULL, NULL, NULL, &pi);

This is working! But: The DLL is 361KB big (!)

Why is this? What have I done wrong?

Thanks

James
 
G

Guest

The last is likely becuae it's bringing in MFC, which you have no need for -
don't use it.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com
 
J

James Hetfield

Hi

If I turn off Static Linked (set to dynamic), I can build it. but when I
create the cab and install it, it just says "cannot install"....

If I have static linked, it is working (but is big)

I will try your link although it seems to be quite a lot to do for a total
new-to-C++...

Thanks
 
J

James Hetfield

Hi Chris

Thanks, but how can I turn it off?

I tried to using dynamic link to it, it is building well, but when I then
install my cab, it just says taht installation failed... if I have static
link, then it is working...

Thanks
 
J

James Hetfield

I have now downloaded eVC++ 4 (+SP4), and created a dll exactly as described
in the link
http://www.pocketpcdn.com/articles/setupdll.html

It did build, only 7.5KB, but when I am trying to install it, it failes...
I'm quite sure that my cab settings are ok, because if I use the big file
with MFC, then it is working...
 
P

Pasquale

I have developed a dll in c++ in order New Project = > Visual C++ => Smart Device => MFC Smart Device DLL.
This th content of dll:


File Type: DLL

Section contains the following exports for LibWrapper.dll

00000000 characteristics
46B19F6E time date stamp Thu Aug 02 11:10:06 2007
0.00 version
1 ordinal base
10 number of functions
10 number of names

ordinal hint RVA name

5 0 000011E4 createOutputStream = ?createOutputStream@@YA_NPAD00@Z (bool __cdecl createOutputStream(char *,char *,char *))
2 1 000010E4 create_stream = ?create_stream@@YAHPBUpjmedia_codec_info@@W4pjmedia_dir@@GPBUpj_sockaddr_in@@PAPAUpjmedia_stream@@@Z (int __cdecl create_stream(struct pjmedia_codec_info const *,enum pjmedia_dir,unsigned short,struct pj_sockaddr_in const *,struct pjmedia_stream * *))
9 2 000012B0 deinit_codecs = ?deinit_codecs@@YAHXZ (int __cdecl deinit_codecs(void))
8 3 000013C0 destroy = ?destroy@@YAXXZ (void __cdecl destroy(void))
1 4 00001068 init_codecs = ?init_codecs@@YAHXZ (int __cdecl init_codecs(void))
7 5 00001010 init_pj = ?init_pj@@YAXHPADH@Z (void __cdecl init_pj(int,char *,int))
3 6 0000129C setLocalPort = ?setLocalPort@@YAXH@Z (void __cdecl setLocalPort(int))
6 7 000013E0 start = ?start@@YAPADXZ (char * __cdecl start(void))
4 8 0000130C stop = ?stop@@YA_NXZ (bool __cdecl stop(void))
10 9 00001294 summ = ?summ@@YAHHH@Z (int __cdecl summ(int,int))

Summary

18000 .data
3000 .pdata
12000 .rdata
3000 .reloc
1000 .rsrc
76000 .text




Now I want use this library in C#, but when I invoke this function

[DllImport("LibWrapper.dll")]
public static extern int summ(int i , int b);
....
public DllWrapper()
{
....
int result =summ(1, 2);
....
}

The emulator throw this exception :

System.MissingMethodException was unhandled
Message="Can't find PInvoke DLL 'LibWrapper.dll'."
StackTrace:
at MyPrimaApp.DllWrapper..ctor()
at MyPrimaApp.Program.Main()

I have tryed to copy the LiWrapper.dll everywhere in the project, but no change.


Please Help me.



EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com
 
J

jp2code

Hi James,

My guess is that you are still starting with an MFC Project.

If you are starting out with an MFC Project, then your installer will
require MFC.

If MFC is included on the device you are trying to install on, then you can
use the smaller build (doesn't wrap MFC into the file). Since your
executable is failing, I would guess your device does not include MFC. So,
to take advantage of MFC, you will need to include it.

If you do not want to use MFC, you are going to have to create a project
*without* MFC. You said you are new to C++, so you may not want to go this
route because there will be several other steps to create your program when
you start with a "non-MFC" project.

Hope this helps,
~Joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top