PC Review


Reply
Thread Tools Rate Thread

DLL NotSupportedException

 
 
Jack P
Guest
Posts: n/a
 
      4th Apr 2009
Hi All,
I am new to DLL, I created a native DLL for Windows application (windows
xp/vista...), it works.

I tried to implement same thing to compact framework ( for windows
mobile/ppc), but can't get work yet...

The run time error is NotSupportedException, but the same thing in windows
application are working fine...

I can see this in my stdafx.h
#define WINVER _WIN32_WCE

so I think it should be right for config but ... still can't work.

Please help.

Thanks.

JB.




The managed code to use DLL:
////////////////////////////
namespace JBDlltest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
double xy = ImplementNativeDll.Add(6.0, 5.0); //////////////
will happen NotSupportedException
}

}

public class ImplementNativeDll
{

[DllImport(@"C:\Users\JB\Documents\Visual Studio
2008\Projects\dllll\dllll\Windows Mobile 5.0 Pocket PC SDK
(ARMV4I)\Debug\dllll.dll", EntryPoint = "Add")]
public static extern double Add(double x, double y);
}
}

and

The native DLL:
/////////////////////////////////////////////////
#include "stdafx.h"

extern "C" __declspec(dllexport) double Add(double x, double y);

__declspec(dllexport) double Add(double x, double y)

{

return (x*y);

}

 
Reply With Quote
 
 
 
 
Chris Tacke, eMVP
Guest
Posts: n/a
 
      4th Apr 2009
You can't create a managed C++ assembly for CE, it's not supported. Not
sure how you even got to a project that you think might create one.

If it's strictly a native DLL, make sure you built it for the right
processor.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com



"Jack P" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi All,
> I am new to DLL, I created a native DLL for Windows application (windows
> xp/vista...), it works.
>
> I tried to implement same thing to compact framework ( for windows
> mobile/ppc), but can't get work yet...
>
> The run time error is NotSupportedException, but the same thing in windows
> application are working fine...
>
> I can see this in my stdafx.h
> #define WINVER _WIN32_WCE
>
> so I think it should be right for config but ... still can't work.
>
> Please help.
>
> Thanks.
>
> JB.
>
>
>
>
> The managed code to use DLL:
> ////////////////////////////
> namespace JBDlltest
> {
> public partial class Form1 : Form
> {
> public Form1()
> {
> InitializeComponent();
> double xy = ImplementNativeDll.Add(6.0, 5.0); //////////////
> will happen NotSupportedException
> }
>
> }
>
> public class ImplementNativeDll
> {
>
> [DllImport(@"C:\Users\JB\Documents\Visual Studio
> 2008\Projects\dllll\dllll\Windows Mobile 5.0 Pocket PC SDK
> (ARMV4I)\Debug\dllll.dll", EntryPoint = "Add")]
> public static extern double Add(double x, double y);
> }
> }
>
> and
>
> The native DLL:
> /////////////////////////////////////////////////
> #include "stdafx.h"
>
> extern "C" __declspec(dllexport) double Add(double x, double y);
>
> __declspec(dllexport) double Add(double x, double y)
>
> {
>
> return (x*y);
>
> }



 
Reply With Quote
 
Jack P
Guest
Posts: n/a
 
      4th Apr 2009
I found one doucmentation:
http://support.microsoft.com/?scid=k...1531&x=21&y=15

and here is my code, and result is as expected => CAN'T WORK.

///////////////////////////
[DllImport("CProcess.DLL", EntryPoint = "WinExecCE")]
public static extern long WinExecCE(string a, string b);
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
long a = WinExecCE("Calc.exe", "");
}
///////////////////////////

I don't know where is wrong ?.

I almost try ANY thing I can do in whatever configurations ( processor,
release / debug ... )

.... Please help..

JB.




"Chris Tacke, eMVP" <ctacke.at.opennetcf.dot.com> wrote in message
news:(E-Mail Removed)...
> You can't create a managed C++ assembly for CE, it's not supported. Not
> sure how you even got to a project that you think might create one.
>
> If it's strictly a native DLL, make sure you built it for the right
> processor.
>
>
> --
>
> Chris Tacke, Embedded MVP
> OpenNETCF Consulting
> Giving back to the embedded community
> http://community.OpenNETCF.com
>
>
>
> "Jack P" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hi All,
>> I am new to DLL, I created a native DLL for Windows application (windows
>> xp/vista...), it works.
>>
>> I tried to implement same thing to compact framework ( for windows
>> mobile/ppc), but can't get work yet...
>>
>> The run time error is NotSupportedException, but the same thing in
>> windows application are working fine...
>>
>> I can see this in my stdafx.h
>> #define WINVER _WIN32_WCE
>>
>> so I think it should be right for config but ... still can't work.
>>
>> Please help.
>>
>> Thanks.
>>
>> JB.
>>
>>
>>
>>
>> The managed code to use DLL:
>> ////////////////////////////
>> namespace JBDlltest
>> {
>> public partial class Form1 : Form
>> {
>> public Form1()
>> {
>> InitializeComponent();
>> double xy = ImplementNativeDll.Add(6.0, 5.0); //////////////
>> will happen NotSupportedException
>> }
>>
>> }
>>
>> public class ImplementNativeDll
>> {
>>
>> [DllImport(@"C:\Users\JB\Documents\Visual Studio
>> 2008\Projects\dllll\dllll\Windows Mobile 5.0 Pocket PC SDK
>> (ARMV4I)\Debug\dllll.dll", EntryPoint = "Add")]
>> public static extern double Add(double x, double y);
>> }
>> }
>>
>> and
>>
>> The native DLL:
>> /////////////////////////////////////////////////
>> #include "stdafx.h"
>>
>> extern "C" __declspec(dllexport) double Add(double x, double y);
>>
>> __declspec(dllexport) double Add(double x, double y)
>>
>> {
>>
>> return (x*y);
>>
>> }

>
>
>

 
Reply With Quote
 
Chris Tacke, eMVP
Guest
Posts: n/a
 
      5th Apr 2009
It returns a 32-bit DWORD. A managed 32-bit is an int, not a long.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com

"Jack P" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>I found one doucmentation:
> http://support.microsoft.com/?scid=k...1531&x=21&y=15
>
> and here is my code, and result is as expected => CAN'T WORK.
>
> ///////////////////////////
> [DllImport("CProcess.DLL", EntryPoint = "WinExecCE")]
> public static extern long WinExecCE(string a, string b);
> public Form1()
> {
> InitializeComponent();
> }
>
> private void Form1_Load(object sender, EventArgs e)
> {
> long a = WinExecCE("Calc.exe", "");
> }
> ///////////////////////////
>
> I don't know where is wrong ?.
>
> I almost try ANY thing I can do in whatever configurations ( processor,
> release / debug ... )
>
> ... Please help..
>
> JB.
>
>
>
>
> "Chris Tacke, eMVP" <ctacke.at.opennetcf.dot.com> wrote in message
> news:(E-Mail Removed)...
>> You can't create a managed C++ assembly for CE, it's not supported. Not
>> sure how you even got to a project that you think might create one.
>>
>> If it's strictly a native DLL, make sure you built it for the right
>> processor.
>>
>>
>> --
>>
>> Chris Tacke, Embedded MVP
>> OpenNETCF Consulting
>> Giving back to the embedded community
>> http://community.OpenNETCF.com
>>
>>
>>
>> "Jack P" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Hi All,
>>> I am new to DLL, I created a native DLL for Windows application (windows
>>> xp/vista...), it works.
>>>
>>> I tried to implement same thing to compact framework ( for windows
>>> mobile/ppc), but can't get work yet...
>>>
>>> The run time error is NotSupportedException, but the same thing in
>>> windows application are working fine...
>>>
>>> I can see this in my stdafx.h
>>> #define WINVER _WIN32_WCE
>>>
>>> so I think it should be right for config but ... still can't work.
>>>
>>> Please help.
>>>
>>> Thanks.
>>>
>>> JB.
>>>
>>>
>>>
>>>
>>> The managed code to use DLL:
>>> ////////////////////////////
>>> namespace JBDlltest
>>> {
>>> public partial class Form1 : Form
>>> {
>>> public Form1()
>>> {
>>> InitializeComponent();
>>> double xy = ImplementNativeDll.Add(6.0, 5.0); //////////////
>>> will happen NotSupportedException
>>> }
>>>
>>> }
>>>
>>> public class ImplementNativeDll
>>> {
>>>
>>> [DllImport(@"C:\Users\JB\Documents\Visual Studio
>>> 2008\Projects\dllll\dllll\Windows Mobile 5.0 Pocket PC SDK
>>> (ARMV4I)\Debug\dllll.dll", EntryPoint = "Add")]
>>> public static extern double Add(double x, double y);
>>> }
>>> }
>>>
>>> and
>>>
>>> The native DLL:
>>> /////////////////////////////////////////////////
>>> #include "stdafx.h"
>>>
>>> extern "C" __declspec(dllexport) double Add(double x, double y);
>>>
>>> __declspec(dllexport) double Add(double x, double y)
>>>
>>> {
>>>
>>> return (x*y);
>>>
>>> }

>>
>>
>>



 
Reply With Quote
 
Jack P
Guest
Posts: n/a
 
      6th Apr 2009
I changed to Int, result is the still fail.

public partial class Form1 : Form
{
[DllImport("CProcess.dll")]
public static extern int WinExecCE(string a, string b);


public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
int a = WinExecCE("Calc.exe", "");
}
}

I can't understand Microsoft put so much black box in compact framework, why
NOT just put the REAL working source code in website for download and verify
.. that's easier and useful.

try and error everyday is really boring stuff.

I can do something in unmanaged code then I just can't do anything in
managed code ...


Thanks.

"Chris Tacke, eMVP" <ctacke.at.opennetcf.dot.com> wrote in message
news:(E-Mail Removed)...
> It returns a 32-bit DWORD. A managed 32-bit is an int, not a long.
>
>
> --
>
> Chris Tacke, Embedded MVP
> OpenNETCF Consulting
> Giving back to the embedded community
> http://community.OpenNETCF.com
>
> "Jack P" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>>I found one doucmentation:
>> http://support.microsoft.com/?scid=k...1531&x=21&y=15
>>
>> and here is my code, and result is as expected => CAN'T WORK.
>>
>> ///////////////////////////
>> [DllImport("CProcess.DLL", EntryPoint = "WinExecCE")]
>> public static extern long WinExecCE(string a, string b);
>> public Form1()
>> {
>> InitializeComponent();
>> }
>>
>> private void Form1_Load(object sender, EventArgs e)
>> {
>> long a = WinExecCE("Calc.exe", "");
>> }
>> ///////////////////////////
>>
>> I don't know where is wrong ?.
>>
>> I almost try ANY thing I can do in whatever configurations ( processor,
>> release / debug ... )
>>
>> ... Please help..
>>
>> JB.
>>
>>
>>
>>
>> "Chris Tacke, eMVP" <ctacke.at.opennetcf.dot.com> wrote in message
>> news:(E-Mail Removed)...
>>> You can't create a managed C++ assembly for CE, it's not supported. Not
>>> sure how you even got to a project that you think might create one.
>>>
>>> If it's strictly a native DLL, make sure you built it for the right
>>> processor.
>>>
>>>
>>> --
>>>
>>> Chris Tacke, Embedded MVP
>>> OpenNETCF Consulting
>>> Giving back to the embedded community
>>> http://community.OpenNETCF.com
>>>
>>>
>>>
>>> "Jack P" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> Hi All,
>>>> I am new to DLL, I created a native DLL for Windows application
>>>> (windows xp/vista...), it works.
>>>>
>>>> I tried to implement same thing to compact framework ( for windows
>>>> mobile/ppc), but can't get work yet...
>>>>
>>>> The run time error is NotSupportedException, but the same thing in
>>>> windows application are working fine...
>>>>
>>>> I can see this in my stdafx.h
>>>> #define WINVER _WIN32_WCE
>>>>
>>>> so I think it should be right for config but ... still can't work.
>>>>
>>>> Please help.
>>>>
>>>> Thanks.
>>>>
>>>> JB.
>>>>
>>>>
>>>>
>>>>
>>>> The managed code to use DLL:
>>>> ////////////////////////////
>>>> namespace JBDlltest
>>>> {
>>>> public partial class Form1 : Form
>>>> {
>>>> public Form1()
>>>> {
>>>> InitializeComponent();
>>>> double xy = ImplementNativeDll.Add(6.0, 5.0); //////////////
>>>> will happen NotSupportedException
>>>> }
>>>>
>>>> }
>>>>
>>>> public class ImplementNativeDll
>>>> {
>>>>
>>>> [DllImport(@"C:\Users\JB\Documents\Visual Studio
>>>> 2008\Projects\dllll\dllll\Windows Mobile 5.0 Pocket PC SDK
>>>> (ARMV4I)\Debug\dllll.dll", EntryPoint = "Add")]
>>>> public static extern double Add(double x, double y);
>>>> }
>>>> }
>>>>
>>>> and
>>>>
>>>> The native DLL:
>>>> /////////////////////////////////////////////////
>>>> #include "stdafx.h"
>>>>
>>>> extern "C" __declspec(dllexport) double Add(double x, double y);
>>>>
>>>> __declspec(dllexport) double Add(double x, double y)
>>>>
>>>> {
>>>>
>>>> return (x*y);
>>>>
>>>> }
>>>
>>>
>>>

>
>
>

 
Reply With Quote
 
Peter Foot
Guest
Posts: n/a
 
      6th Apr 2009
Okay, going back to basics what are you actually trying to achieve this this
code? Do you want to launch the calculator application?

Peter

--
Peter Foot
Microsoft Device Application Development MVP
peterfoot.net | appamundi.com | inthehand.com
APPA Mundi Ltd - software solutions for a mobile world
In The Hand Ltd - .NET Components for Mobility

"Jack P" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> I changed to Int, result is the still fail.
>
> public partial class Form1 : Form
> {
> [DllImport("CProcess.dll")]
> public static extern int WinExecCE(string a, string b);
>
>
> public Form1()
> {
> InitializeComponent();
> }
>
> private void Form1_Load(object sender, EventArgs e)
> {
> int a = WinExecCE("Calc.exe", "");
> }
> }
>
> I can't understand Microsoft put so much black box in compact framework,
> why NOT just put the REAL working source code in website for download and
> verify . that's easier and useful.
>
> try and error everyday is really boring stuff.
>
> I can do something in unmanaged code then I just can't do anything in
> managed code ...
>
>
> Thanks.
>
> "Chris Tacke, eMVP" <ctacke.at.opennetcf.dot.com> wrote in message
> news:(E-Mail Removed)...
>> It returns a 32-bit DWORD. A managed 32-bit is an int, not a long.
>>
>>
>> --
>>
>> Chris Tacke, Embedded MVP
>> OpenNETCF Consulting
>> Giving back to the embedded community
>> http://community.OpenNETCF.com
>>
>> "Jack P" <(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>>>I found one doucmentation:
>>> http://support.microsoft.com/?scid=k...1531&x=21&y=15
>>>
>>> and here is my code, and result is as expected => CAN'T WORK.
>>>
>>> ///////////////////////////
>>> [DllImport("CProcess.DLL", EntryPoint = "WinExecCE")]
>>> public static extern long WinExecCE(string a, string b);
>>> public Form1()
>>> {
>>> InitializeComponent();
>>> }
>>>
>>> private void Form1_Load(object sender, EventArgs e)
>>> {
>>> long a = WinExecCE("Calc.exe", "");
>>> }
>>> ///////////////////////////
>>>
>>> I don't know where is wrong ?.
>>>
>>> I almost try ANY thing I can do in whatever configurations ( processor,
>>> release / debug ... )
>>>
>>> ... Please help..
>>>
>>> JB.
>>>
>>>
>>>
>>>
>>> "Chris Tacke, eMVP" <ctacke.at.opennetcf.dot.com> wrote in message
>>> news:(E-Mail Removed)...
>>>> You can't create a managed C++ assembly for CE, it's not supported.
>>>> Not sure how you even got to a project that you think might create one.
>>>>
>>>> If it's strictly a native DLL, make sure you built it for the right
>>>> processor.
>>>>
>>>>
>>>> --
>>>>
>>>> Chris Tacke, Embedded MVP
>>>> OpenNETCF Consulting
>>>> Giving back to the embedded community
>>>> http://community.OpenNETCF.com
>>>>
>>>>
>>>>
>>>> "Jack P" <(E-Mail Removed)> wrote in message
>>>> news:(E-Mail Removed)...
>>>>> Hi All,
>>>>> I am new to DLL, I created a native DLL for Windows application
>>>>> (windows xp/vista...), it works.
>>>>>
>>>>> I tried to implement same thing to compact framework ( for windows
>>>>> mobile/ppc), but can't get work yet...
>>>>>
>>>>> The run time error is NotSupportedException, but the same thing in
>>>>> windows application are working fine...
>>>>>
>>>>> I can see this in my stdafx.h
>>>>> #define WINVER _WIN32_WCE
>>>>>
>>>>> so I think it should be right for config but ... still can't work.
>>>>>
>>>>> Please help.
>>>>>
>>>>> Thanks.
>>>>>
>>>>> JB.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> The managed code to use DLL:
>>>>> ////////////////////////////
>>>>> namespace JBDlltest
>>>>> {
>>>>> public partial class Form1 : Form
>>>>> {
>>>>> public Form1()
>>>>> {
>>>>> InitializeComponent();
>>>>> double xy = ImplementNativeDll.Add(6.0, 5.0);
>>>>> ////////////// will happen NotSupportedException
>>>>> }
>>>>>
>>>>> }
>>>>>
>>>>> public class ImplementNativeDll
>>>>> {
>>>>>
>>>>> [DllImport(@"C:\Users\JB\Documents\Visual Studio
>>>>> 2008\Projects\dllll\dllll\Windows Mobile 5.0 Pocket PC SDK
>>>>> (ARMV4I)\Debug\dllll.dll", EntryPoint = "Add")]
>>>>> public static extern double Add(double x, double y);
>>>>> }
>>>>> }
>>>>>
>>>>> and
>>>>>
>>>>> The native DLL:
>>>>> /////////////////////////////////////////////////
>>>>> #include "stdafx.h"
>>>>>
>>>>> extern "C" __declspec(dllexport) double Add(double x, double y);
>>>>>
>>>>> __declspec(dllexport) double Add(double x, double y)
>>>>>
>>>>> {
>>>>>
>>>>> return (x*y);
>>>>>
>>>>> }
>>>>
>>>>
>>>>

>>
>>
>>

 
Reply With Quote
 
Chris Tacke, eMVP
Guest
Posts: n/a
 
      6th Apr 2009
It's not a black box at all. It's all very, very well documented. If this
isn't working it's because *you* are doing something wrong, not becasue of
some global Microsoft conspiracy to prevent you from doing it. What is the
old addage about the mechanic who blames his tools?

What you need to do at this point is:

1. Make sure that your native project is a Smart Device project (not a
desktop project) and that it is targeting the right processor.
2. Use dumpbin and make sure that you are actually exporting the function
you think you are and that the name is unmangled.
3. Make sure that the native DLL is eitehr in the device's \Windows folder
or in the application folder
4. Make sure that your managed application is actually on the target device
(I've had times where one project was pushing to an emulator and the other
to a device, or to two separate emulators).


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com



"Jack P" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>I changed to Int, result is the still fail.
>
> public partial class Form1 : Form
> {
> [DllImport("CProcess.dll")]
> public static extern int WinExecCE(string a, string b);
>
>
> public Form1()
> {
> InitializeComponent();
> }
>
> private void Form1_Load(object sender, EventArgs e)
> {
> int a = WinExecCE("Calc.exe", "");
> }
> }
>
> I can't understand Microsoft put so much black box in compact framework,
> why NOT just put the REAL working source code in website for download and
> verify . that's easier and useful.
>
> try and error everyday is really boring stuff.
>
> I can do something in unmanaged code then I just can't do anything in
> managed code ...
>
>
> Thanks.
>
> "Chris Tacke, eMVP" <ctacke.at.opennetcf.dot.com> wrote in message
> news:(E-Mail Removed)...
>> It returns a 32-bit DWORD. A managed 32-bit is an int, not a long.
>>
>>
>> --
>>
>> Chris Tacke, Embedded MVP
>> OpenNETCF Consulting
>> Giving back to the embedded community
>> http://community.OpenNETCF.com
>>
>> "Jack P" <(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>>>I found one doucmentation:
>>> http://support.microsoft.com/?scid=k...1531&x=21&y=15
>>>
>>> and here is my code, and result is as expected => CAN'T WORK.
>>>
>>> ///////////////////////////
>>> [DllImport("CProcess.DLL", EntryPoint = "WinExecCE")]
>>> public static extern long WinExecCE(string a, string b);
>>> public Form1()
>>> {
>>> InitializeComponent();
>>> }
>>>
>>> private void Form1_Load(object sender, EventArgs e)
>>> {
>>> long a = WinExecCE("Calc.exe", "");
>>> }
>>> ///////////////////////////
>>>
>>> I don't know where is wrong ?.
>>>
>>> I almost try ANY thing I can do in whatever configurations ( processor,
>>> release / debug ... )
>>>
>>> ... Please help..
>>>
>>> JB.
>>>
>>>
>>>
>>>
>>> "Chris Tacke, eMVP" <ctacke.at.opennetcf.dot.com> wrote in message
>>> news:(E-Mail Removed)...
>>>> You can't create a managed C++ assembly for CE, it's not supported.
>>>> Not sure how you even got to a project that you think might create one.
>>>>
>>>> If it's strictly a native DLL, make sure you built it for the right
>>>> processor.
>>>>
>>>>
>>>> --
>>>>
>>>> Chris Tacke, Embedded MVP
>>>> OpenNETCF Consulting
>>>> Giving back to the embedded community
>>>> http://community.OpenNETCF.com
>>>>
>>>>
>>>>
>>>> "Jack P" <(E-Mail Removed)> wrote in message
>>>> news:(E-Mail Removed)...
>>>>> Hi All,
>>>>> I am new to DLL, I created a native DLL for Windows application
>>>>> (windows xp/vista...), it works.
>>>>>
>>>>> I tried to implement same thing to compact framework ( for windows
>>>>> mobile/ppc), but can't get work yet...
>>>>>
>>>>> The run time error is NotSupportedException, but the same thing in
>>>>> windows application are working fine...
>>>>>
>>>>> I can see this in my stdafx.h
>>>>> #define WINVER _WIN32_WCE
>>>>>
>>>>> so I think it should be right for config but ... still can't work.
>>>>>
>>>>> Please help.
>>>>>
>>>>> Thanks.
>>>>>
>>>>> JB.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> The managed code to use DLL:
>>>>> ////////////////////////////
>>>>> namespace JBDlltest
>>>>> {
>>>>> public partial class Form1 : Form
>>>>> {
>>>>> public Form1()
>>>>> {
>>>>> InitializeComponent();
>>>>> double xy = ImplementNativeDll.Add(6.0, 5.0);
>>>>> ////////////// will happen NotSupportedException
>>>>> }
>>>>>
>>>>> }
>>>>>
>>>>> public class ImplementNativeDll
>>>>> {
>>>>>
>>>>> [DllImport(@"C:\Users\JB\Documents\Visual Studio
>>>>> 2008\Projects\dllll\dllll\Windows Mobile 5.0 Pocket PC SDK
>>>>> (ARMV4I)\Debug\dllll.dll", EntryPoint = "Add")]
>>>>> public static extern double Add(double x, double y);
>>>>> }
>>>>> }
>>>>>
>>>>> and
>>>>>
>>>>> The native DLL:
>>>>> /////////////////////////////////////////////////
>>>>> #include "stdafx.h"
>>>>>
>>>>> extern "C" __declspec(dllexport) double Add(double x, double y);
>>>>>
>>>>> __declspec(dllexport) double Add(double x, double y)
>>>>>
>>>>> {
>>>>>
>>>>> return (x*y);
>>>>>
>>>>> }
>>>>
>>>>
>>>>

>>
>>
>>



 
Reply With Quote
 
Christopher Fairbairn [MVP]
Guest
Posts: n/a
 
      7th Apr 2009
Hi Jack,

"Jack P" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> I can't understand Microsoft put so much black box in compact framework
>
> try and error everyday is really boring stuff.


No platform is a magic bullet. You need to invest the time to learn the
specifics of the environment and its related development tools. I doubt
you'll find Android, iPhone, Symbian or Blackberry significantly different
in this regard..

As Peter mentioned it would also help if you clearly spelt out what you are
attempting to acheive. One code sample you posted showed a C++ calculator
type API, while the present one references an old eVB sample for launching
applications. What is you're desired outcome?

I assume you are wanting to learn how to implement Platform Invoke calls
into C/C++ code you are going to write. As Chris Tacke pointed out, your
difficulty is probably related to one of two things:

A) Knowing how to correctly build your native DLL so it exposes the function
in a compatable form

B) Knowing how to correctly deploy both the native and managed parts of your
application to the emulator/device

To help you along the way I went through the old eVB example you mentioned
and created a Visual Studio 2008 / .NET CF 3.5 project which demonstrates
the same thing.

You can download the source code at
http://www.christec.co.nz/blog/wp-co...okeexample.zip.
Hopefully you will be able to set both projects to deploy to the same device
and see that clicking the button in the managed app launches the calendar
application via the native DLL (although using the
System.Diagnostics.Process class would be a better solution for this
specific task).

If you have any difficulty deploying the project(s) we should be able to
work through them.

Hope this helps,
Christopher Fairbairn


 
Reply With Quote
 
Jack P
Guest
Posts: n/a
 
      7th Apr 2009
Hi all,
I have done it finally.

I think the difficulty is just a little lower than Cage finding his
treasure.

Cheers!

"Christopher Fairbairn [MVP]" <(E-Mail Removed)> wrote in message
news:O$(E-Mail Removed)...
> Hi Jack,
>
> "Jack P" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> I can't understand Microsoft put so much black box in compact framework
>>
>> try and error everyday is really boring stuff.

>
> No platform is a magic bullet. You need to invest the time to learn the
> specifics of the environment and its related development tools. I doubt
> you'll find Android, iPhone, Symbian or Blackberry significantly different
> in this regard..
>
> As Peter mentioned it would also help if you clearly spelt out what you
> are attempting to acheive. One code sample you posted showed a C++
> calculator type API, while the present one references an old eVB sample
> for launching applications. What is you're desired outcome?
>
> I assume you are wanting to learn how to implement Platform Invoke calls
> into C/C++ code you are going to write. As Chris Tacke pointed out, your
> difficulty is probably related to one of two things:
>
> A) Knowing how to correctly build your native DLL so it exposes the
> function in a compatable form
>
> B) Knowing how to correctly deploy both the native and managed parts of
> your application to the emulator/device
>
> To help you along the way I went through the old eVB example you mentioned
> and created a Visual Studio 2008 / .NET CF 3.5 project which demonstrates
> the same thing.
>
> You can download the source code at
> http://www.christec.co.nz/blog/wp-co...okeexample.zip.
> Hopefully you will be able to set both projects to deploy to the same
> device and see that clicking the button in the managed app launches the
> calendar application via the native DLL (although using the
> System.Diagnostics.Process class would be a better solution for this
> specific task).
>
> If you have any difficulty deploying the project(s) we should be able to
> work through them.
>
> Hope this helps,
> Christopher Fairbairn
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
'System.NotSupportedException' Kenneth Windish Microsoft Dot NET Compact Framework 6 25th Nov 2008 05:10 AM
NotSupportedException steve.fillingham@gmail.com Microsoft Dot NET Compact Framework 2 21st Nov 2008 04:18 AM
NotSupportedException Andy Baker Microsoft Dot NET Compact Framework 3 10th Jan 2008 04:41 PM
Re: NotSupportedException and LSP Alexei Zakharov Microsoft Dot NET Framework 1 26th Aug 2003 05:16 PM
Re: NotSupportedException and LSP Herman Eldering Microsoft Dot NET Framework 0 24th Aug 2003 02:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:36 PM.