Problem calling PInvoke on Smartphone emulator

S

Saurabh Chawla

Hi,
I am working on smartphone emulator. with generating dll on evc++4.0.
The code that i have written is :

[DllImport("abc.dll",SetLastError=true)]
public static extern int check(int A);

and called check function in my code c#.

Also , i have checked through dumpbin utility that the check function
is exposed in abc.dll.

In the emulator i am making abc.dll as a content file. so it is loaded
at the location of the application.CHecked that as well.

Still the error MissingMethodException is coming. Can anyone tell me
the reason for that.

I also tried making separate dll for emulator(x86 based) and
device(arm based), no use.
 
P

Peter Foot [MVP]

You will definately need an x86 build on the emulator which is different
from the ARM build you would use on a device. Delete the file from the
emulator, and remove the dll from your project and then add back to your
project ensuring you specify the x86 version and BuildAction is set to
content. You could check with File.Exists() if the file is present.

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups
 
S

Saurabh Chawla

Thanks,
the problem was that i was making dll based on mfc classes which i
found out that smartphone has no support for mfc classes. I made
another dll (excluding mfc files) and it worked properly.



Peter Foot said:
You will definately need an x86 build on the emulator which is different
from the ARM build you would use on a device. Delete the file from the
emulator, and remove the dll from your project and then add back to your
project ensuring you specify the x86 version and BuildAction is set to
content. You could check with File.Exists() if the file is present.

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups

Saurabh Chawla said:
Hi,
I am working on smartphone emulator. with generating dll on evc++4.0.
The code that i have written is :

[DllImport("abc.dll",SetLastError=true)]
public static extern int check(int A);

and called check function in my code c#.

Also , i have checked through dumpbin utility that the check function
is exposed in abc.dll.

In the emulator i am making abc.dll as a content file. so it is loaded
at the location of the application.CHecked that as well.

Still the error MissingMethodException is coming. Can anyone tell me
the reason for that.

I also tried making separate dll for emulator(x86 based) and
device(arm based), no use.
 

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