Using non .net dll in .net compact framework

B

babu reddy

Hi,
My problem is that I have a dll which i need to use in
my .net compact framework application, which i am
creating for iPAQ. I went through a lot of articles on
this problem and found that the solution is to DECLARE
the dll method and use it in .net CF.
The dll exposes a single function which returns a string
Function - readTag() As String

My declaration statement goes like this:
Declare Function readTag Lib "RFIDRead.dll" () As String

If i try to run my application, it returned me
NotSupportedException.
I then changed the return value as "char" from "String",
now its returning me MissingMethodException.
Even if I delete the dll from the iPAQ, still i get the
same error.
From all my research, i think the my declaration
statement is correct, but i think that either i have to
register my RFIDRead.dll in the iPAQ or soemthing of that
sort.
Can anyone help me with this, any source code on the same
with proper steps will be really helpful

Thanks in advance...
 
A

Alex Yakhnin [MVP]

Marshaller in CF has some restrictions in the size of the
data returned from a native call - it's limited to 32bits.
What is the original signature of your function in C?
You might be able to get away by declaring a returning
type as IntPtr and then calling Marshal.PtrToStringUni.
 

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