Jump to content

Dll call to C# dll function display error 3 (Function not found)


Recommended Posts

Hi,

Please help. I am working on this for a while.

I have created a simple dll in c#(Visual studio 2008 express edition) to Add 2 numbers. When i call this dll using

$result = DllCall("Adddll.dll","none","AdddClass")

i receive error 3 "Dll Function not found"

$dll= @WindowsDir & '\Adddll.dll'

$result = DllCall($dll,"int","AddingValues")

If @error = 1 Then MsgBox(0,"ERROR","Unable to use the DLL file.")

If @error = 2 Then MsgBox(0,"ERROR","Unknown return type.")

If @error = 3 Then MsgBox(0,"ERROR","Function not found in the DLL file.")

1. Do i have to include any files

2. what is wrong in the dll call

3. Is it possible to call c# dll using autoIt

I copied the Adddll.dll in c:\Windows drive.

Below is my c# code

using System;

using System.Text;

using System.IO;

namespace Adddll

{

public class AddClass

{

public AddClass()

{

}

public int AddingValues()

{

int a = 10;

int b = 20;

int c = a + b;

String outputFile = "c:/ocr/outputValue.txt";

TextWriter tw = new StreamWriter(outputFile);

tw.WriteLine©;

tw.Close();

return c;

}

}

}

Link to comment
Share on other sites

Im not sure but here you call function "AdddClass"

$result = DllCall("Adddll.dll","none","AdddClass")

I don't see that anywhere in your code..

Link to comment
Share on other sites

Thank you for all your quick response. Below is the code with the function AddingValues.

$result = DllCall($dll,"int","AdddingValues")

i receive error 3 "Dll Function not found".

Below is the AutoIt code...

$dll= @WindowsDir & '\Adddll.dll'

$result = DllCall($dll,"int","AddingValues")

If @error = 1 Then MsgBox(0,"ERROR","Unable to use the DLL file.")

If @error = 2 Then MsgBox(0,"ERROR","Unknown return type.")

If @error = 3 Then MsgBox(0,"ERROR","Function not found in the DLL file.")

1. Do i have to include any files

2. what is wrong in the dll call

3. Is it possible to call c# dll using autoIt

Edited by Great
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...