cppman Posted July 9, 2006 Share Posted July 9, 2006 is it possible to make a dll call to a dll written in C#? My friend said, its not... but I was curious... i've seen some console function that the dll was written in C#(i think).. is it possible? Miva OS Project Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 9, 2006 Moderators Share Posted July 9, 2006 Why wouldn't it be possible I think is the better question. Have you tried? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
evilertoaster Posted July 9, 2006 Share Posted July 9, 2006 I beleive it's entirely possible as long it's it is a 'standard' format dll. As it says in the help file for dllcall, some dlls are a different standard and take aruments in a different way. Any particular case in mind? Link to comment Share on other sites More sharing options...
cppman Posted July 9, 2006 Author Share Posted July 9, 2006 (edited) here is the reason my friend said it would'nt work: "native dll's like the ones made in C++ are compiled down into machine code. machine code is ASM. C# dll's are compiled down to MSIL (I belive that is it). than when you run the dll or exe the .net CLR takes the MSIL and compiles it down to Machine Code. but the problem is the CLR doesn't compile the whole thing, it is inteligent. those are the reasons it doesn't work. you can call native from managed but not managed from native"... and i just wanted to know if it'd work before i take the time to write a class library... i did a quick test and does'nt seem to work... c# code: using System; using System.IO; namespace ClassLibrary3 { /// <summary> /// Summary description for Class1. /// </summary> public class Class1 { public Class1() { } public void fwrite() { FileStream fs = new FileStream("file.txt", System.IO.FileMode.Open); StreamWriter sw = new StreamWriter("file.txt"); sw.Write("test"); sw.Close(); fs.Close(); } } } auto it code: DllCall("test.dll", "none", "fwrite") * I know someone wrote a C# dll and used it for some console functions im sure, but could'nt find that thread... Edited July 9, 2006 by CHRIS95219 Miva OS Project Link to comment Share on other sites More sharing options...
evilertoaster Posted July 9, 2006 Share Posted July 9, 2006 (edited) Your friend is right, but he's also jumping the gun a little...C# dll are compiled to MSIL only using the microsoft compiler (like in visual studio)You need a different compiler (look at ngen at http://msdn2.microsoft.com/en-us/library/6t9t5wcf.aspx) to compile it into machine code like your friend said.Edit: posted link wrong Edited July 9, 2006 by evilertoaster Link to comment Share on other sites More sharing options...
Uten Posted July 9, 2006 Share Posted July 9, 2006 I'm quite shure I have seen tools to make stub dll's to make calls to a C# "dll" possible. But there are probably a lot of constraints on what your aloved to do. I also think you would be better of using a COM dll and the COM interface/methodes in AutoIt. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
cppman Posted July 9, 2006 Author Share Posted July 9, 2006 (edited) Your friend is right, but he's also jumping the gun a little...C# dll are compiled to MSIL only using the microsoft compiler (like in visual studio)You need a different compiler (look at ngen at http://msdn2.microsoft.com/en-us/library/6t9t5wcf.aspx) to compile it into machine code like your friend said.ah. That sounds more reasonable. Thanks.ulten > Im not sure how to write a COM dll.. I've searched for tutorials but can't seem to find any.. Edited July 9, 2006 by CHRIS95219 Miva OS Project Link to comment Share on other sites More sharing options...
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