Sign in to follow this  
Followers 0
Raedon

Help Whit Dll import

5 posts in this topic

Hi all, im a new user of Autoit, usually i use C# but this time y need use Autoit.

I have a question about how to use a Custome DLL made in C#, Here is the code of this DLL

namespace Math
{
    public class AddClass 
    {
        public static long Add(long i, long j) 
        { 
            return (i + j);
        }
    }
}

Now, i saw in the Function Reference of autoit, how to use DLLCall

DllCall ( "dll", "return type", "function" [, "type1", param1 [, "type n", param n]] )

In my case this go this way; DllCall ( "Math", "long", "Add" , "long", "$i" , "long", "$j )

Its this ok? i mean, the sintax? and other think, how i invoke later the Add Function?

Thanks.

Share this post


Link to post
Share on other sites



Hi all, im a new user of Autoit, usually i use C# but this time y need use Autoit.

I have a question about how to use a Custome DLL made in C#, Here is the code of this DLL

namespace Math
{
    public class AddClass 
    {
        public static long Add(long i, long j) 
        { 
            return (i + j);
        }
    }
}

Now, i saw in the Function Reference of autoit, how to use DLLCall

DllCall ( "dll", "return type", "function" [, "type1", param1 [, "type n", param n]] )

In my case this go this way; DllCall ( "Math", "long", "Add" , "long", "$i" , "long", "$j )

Its this ok? i mean, the sintax? and other think, how i invoke later the Add Function?

Thanks.

You can't do that. DLL that you make will not export any function.

C# compilers compile differently. Code within that dll file needs to be 'interpreted' (wrong term) before you would be able to use it (you need CPU instructions). That is the job of imported function, in your case _CorDllMain from mscoree.dll.

Short version, no exported function = no DllCall() ability


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Hi all, im a new user of Autoit, usually i use C# but this time y need use Autoit.

I have a question about how to use a Custome DLL made in C#, Here is the code of this DLL

namespace Math
{
    public class AddClass 
    {
        public static long Add(long i, long j) 
        { 
            return (i + j);
        }
    }
}

Now, i saw in the Function Reference of autoit, how to use DLLCall

DllCall ( "dll", "return type", "function" [, "type1", param1 [, "type n", param n]] )

In my case this go this way; DllCall ( "Math", "long", "Add" , "long", "$i" , "long", "$j )

Its this ok? i mean, the sintax? and other think, how i invoke later the Add Function?

Thanks.

Autoit working on the C++6 Executable file

Exporting C Functions for Use in C or C++ Language Executables

http://msdn.microsoft.com/en-us/library/ys435b3s%28VS.80%29.aspx

Using extern to Specify Linkage

http://msdn.microsoft.com/en-us/library/0603949d%28VS.80%29.aspx

cdecl

By default, AutoIt uses the 'stdcall' calling method. To use the 'cdecl' method place ':cdecl' after the return type.

DllCall("SQLite.dll", "int:cdecl", "sqlite3_open", "str", $sDatabase_Filename , "long*", 0).

Example Here

Look at the Autoit_RichEditCtrl.cpp

Autoit_RichEditCtrl Library

http://www.autoitscript.com/forum/index.php?showtopic=95200&st=0&p=684194&fromsearch=1&#entry684194


صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I follow this example on who to export a funtion of a c# dll to use it on c++ proyects

http://www.codeproject.com/KB/dotnet/DllExport.aspx?fid=356836&select=2574834&fr=1#xx2574834xx

Now, how i do to call the Add function prevosly posted??

$result = DllCall ( "Math.dll", "long", "Add" , "long", 5 , "long", 4 )

Thanks.

Edited by Raedon

Share this post


Link to post
Share on other sites

Could you show Math.dll?


♡♡♡

.

eMyvnE

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  
Followers 0