Jump to content
Sign in to follow this  
Great

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

Recommended Posts

Great

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;

}

}

}

Share this post


Link to post
Share on other sites
Beege

Im not sure but here you call function "AdddClass"

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

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

Share this post


Link to post
Share on other sites
trancexx

c# (and for a while).


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
PsaltyDS

It that just a typo? "Adddll" has three d's in it, but surely "AdddClass" should only have two?

:mellow:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Great

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

Share this post


Link to post
Share on other sites
Richard Robertson

No, AutoIt cannot directly use a C# dll.

Share this post


Link to post
Share on other sites
Great

No, AutoIt cannot directly use a C# dll.

What do i have to do to call c# dll?

Share this post


Link to post
Share on other sites
wraithdu

Probably write a C/C++ dll to call the C# dll function for you and return the result. I don't know C# so I can't give you any more advice.

Share this post


Link to post
Share on other sites
Richard Robertson

To use a .Net dll, you need to be using a language that targets the .Net framework. It's doable from AutoIt but not simple at all.

Share this post


Link to post
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
Sign in to follow this  

×