C# calling DLL written for Windows

G

Guest

I am writing a C# application which is to call a DLL which another group in
the company I work for wrote for a Windows Application.

The functions in the DLL, which I am calling, are all prefaced with "FAR
PASCAL EXPORT".

In my application I have declared:
[DllImport(@("dll path and name")]
public static extern int AT_Devfice_Get_Status(int DeviceNumber);
..
..
..
serial = AT_Device_Get_Status(1);
..
..
..
Were I call the function, AT_Device_Get_Status(1), the function breeaks and
the message:
An unhandled exception of type 'System.NullRefernceException' occurred in
Vaprel.exe
Additional information: Object reference not set to an instance of an object.

I believe that this error or exception may be caused by the decleration of
the function in the C# code. I don't know how to declare the 'FAR PASCAL
EXTERN' in C#. How do I do this?
 
M

Mattias Sjögren

I believe that this error or exception may be caused by the decleration of
the function in the C# code. I don't know how to declare the 'FAR PASCAL
EXTERN' in C#. How do I do this?

You can pretty much ignore that part. But what does the rest of the
native function declaration look like?



Mattias
 

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