kmeleon Posted July 19, 2011 Posted July 19, 2011 Hello, I have project Class Library in VS C# and I want call this function "Add" but I still have error 3 - "function" not found in the DLL file. How fix it ? >>Code in VS C# using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ClassLibrary1 { public class Class1 { public int Add(int p1, int p2) { return p1 + p2; } public int Subtract(int p1, int p2) { return p1 - p2; } } } >>Code in AutoIt $h = ""&@ScriptDir &"\ClassLibrary1.dll" $Add = DllCall(""&$h, "int", "Add", "int", 3, "int", 4) If @error <> 0 Then MsgBox(0,""&$Add,"error: "&@error) Else MsgBox(0,"",""&$Add) EndIf Feed Polish children: pajacyk - just go to this page and close it. Thanks. World website: free rice.
Mat Posted July 19, 2011 Posted July 19, 2011 .NET dlls are special. They are nothing like those designed to work with DllCall. AutoIt Project Listing
kmeleon Posted July 20, 2011 Author Posted July 20, 2011 This is how best to choose a project in VS to create a library that will work with AutoIt? Feed Polish children: pajacyk - just go to this page and close it. Thanks. World website: free rice.
Mat Posted July 20, 2011 Posted July 20, 2011 It needs to be a Win32 Dll, so the way I get there (almost certainly not the way you get there) is New Project -> Other Langauges -> Visual C++ -> Win32 -> Win32 Project, and then when the dialog opens you need to tick the radio button that says Dll. AutoIt Project Listing
zfisherdrums Posted July 21, 2011 Posted July 21, 2011 (edited) This is how best to choose a project in VS to create a library that will work with AutoIt?If you want to keep it in C#, you should check out the Unmanaged Exports project. It is a project template that allows native consumption of managed DLLs without the typical compilation/deployment overhead. You decorate your methods with a specific attribute and...voila! Have I used it before? No. Just Google-foo. May be worth checking out.Best,Zach... Edited July 21, 2011 by zfisherdrums Identify .NET controls by their design time namesLazyReader© could have read all this for you. Unit Testing for AutoItFolder WatcherWord Doc ComparisonThis here blog...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now