Repost: Re: DllImport for Windows CE for pocket PC device development

  • Thread starter Thread starter Kenric Li
  • Start date Start date
K

Kenric Li

Hi Chris and BJ,

I am working in the same library too. I tired to use the Visual C++ to link
to this win ce.net dll, and from Visual C++, I can see the method and build
with the following code:


// This is the main project file for VC++ application project

// generated using an Application Wizard.

#include <windows.h>

#include <stdio.h>

#using <mscorlib.dll>

#include <tchar.h>

using namespace System::Runtime::InteropServices;

#using "MPU-L465.dll"

using namespace System;

using namespace SII;

int _tmain(void)

{

Int32 rc;


SII::MPU_L465 * mpul465 = new SII::MPU_L465();

Console::WriteLine(S"Hello World");

System::String *obj1 = new String (_T("3"));

mpul465->ComPort=obj1;

return 0;

}

but it failed in the 2nd line of the main program when creating
constuructor.

The message I got is a missing link. It failed in crt0.c in line 259:

#else /* WPRFLAG */

__initenv = _environ;

mainret = main(__argc, __argv, _environ);



and we a look at the even lot, the linking problem occur in
CEUDPPerfExt.dll from the WinCE library and I have that fiile in the
indicated folder.

So.. I wonder if anyone can give me any suggestions?
 
What language are you using there? That looks like managed C++ which is NOT
supported on Windows CE.NET devices at this time.
 
Hi Steve,

I am using Visual C++ .net 2002. The dll I am linking seems to be
programmed by Windows CE.net

Would you kindly give me any suggestions?

Regards,

Kenric
 
You're using a development environment which doesn't support your target
device. If you want to use unmanaged C++ to program your Pocket PC, you
should download eMbedded Visual C++ (3.0 or 4.0, depending on whether you
are using PPC 2000/2002 or 2003).

You *can* use managed code on your Pocket PC, but you must have Visual
***Studio***.NET 2003 Pro or better to do that.

By the same token, if you have a DLL which is compiled for Windows CE.NET,
it *won't work* on desktop Windows without being recompiled.

Paul T.
 
Paul,

So can you give me some advice on what I can do? Here are my design
constraints:

1) I have an dll which was programmed by Windows CE .Net, that I have to
link to and developed on top of.

2) I would like to develop a dll / library (can be either by managed or
unmanaged code) which link to that dll indicated in (1) to be ran on Pocket
PC 2002.

3) My preference is to develop some other unmanaged C++ code to invoke the
layer in (2)

Thanks

Kenric
 
1) Targeting Windows CE.NET? If so, download and install eMbedded Visual
C++ 4.0.

2) Well, for this, you'll have to get eMbedded Visual C++ ***3.0***. You
won't be able to use that same DLL from #1 in this scenario, though, as it's
OS version will be set to a higher number than the OS on the PPC2002, so it
won't run. You'll have to either get the source and build it yourself with
eVC 3 or have whomever developed it originally rebuild it with eVC 3 for
you.

3) OK. If you're targeting PPC 2002, then you'd use eVC 3.0 for this.

Paul T.
 
Paul,

Thanks for your advice.

Kenric


Paul G. Tobey said:
1) Targeting Windows CE.NET? If so, download and install eMbedded Visual
C++ 4.0.

2) Well, for this, you'll have to get eMbedded Visual C++ ***3.0***. You
won't be able to use that same DLL from #1 in this scenario, though, as it's
OS version will be set to a higher number than the OS on the PPC2002, so it
won't run. You'll have to either get the source and build it yourself with
eVC 3 or have whomever developed it originally rebuild it with eVC 3 for
you.

3) OK. If you're targeting PPC 2002, then you'd use eVC 3.0 for this.

Paul T.
 
Paul,

Actually, I have a very fundamental question:

If I have a dll developed in unmanaged visual C++, is it possible for it to
invoke a managed dll which used some .net APIs

Regards,

Kenric
 
Kenric,

You can't invoke code in Compact Framework DLLs from an eVC++ DLL. You could
do something crude like CreateProcess to execute a managed app from an
unmanaged one and the managed app could understand command line args passed
to it, but that's about it.
 
Ken,

I think the best way to do this is C# or VB.NET. However, since the library
is developed in WinCE.NET. It may not work with PocketPC 2002 (WinCE 3.0).
You may need to have it run in PocketPC 2003 (WinCE.NET).
 
Back
Top