obrienj Posted July 16, 2008 Share Posted July 16, 2008 I originally posted a question about C# that was too specific in context.The more general question should be:Can AutoIt load and call methods in a C# class library DLL?I have such a DLL that appears to be loaded via DllOpen, yet the constructor is not invoked.I can then call a public method via DllCall, yet it seems not to be invoked.No errors are reported from any of the elements (AutoIt, C#, Windows).This same DLL works just fine when invoked by the Basic4PPC package. I use this package to write scripts for my PDA and it allows scripts to be written for the host as well which is, of couse, what I use for this testing. The DLL was built using #Develop which is a free C# development package. .Net 2.0 is in use as well.Any comments?Regards,Jim Link to comment Share on other sites More sharing options...
Airwolf Posted July 16, 2008 Share Posted July 16, 2008 No errors are reported from any of the elements (AutoIt, C#, Windows).Do you mean no visible errors? Or does @error remain 0? Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt Link to comment Share on other sites More sharing options...
LarryDalooza Posted July 16, 2008 Share Posted July 16, 2008 Don't you need an "interop" dll? Whatever the hell that is... Lar. AutoIt has helped make me wealthy Link to comment Share on other sites More sharing options...
obrienj Posted July 16, 2008 Author Share Posted July 16, 2008 (edited) On a more thorough re-examination, I do, in fact, get a error returned from the DLLCall. I had coded the test for it incorrectly. Specifically the testing shows: When I load the DLL with DLLOpen, a handle of 0x00000001 is returned. When I call the function "testit", I do get an @error=3 indicating that the function wasn't found. The C# definition of the "function" (method) is: public void testit() { MessageBox(IntPtr.Zero, "testit entered.\n","RRIntfB4PPC", 0); } and the AutoIt call is: Dllcall($auxB4PPCDLLHndl, "None", "testit") if @error Then logger("Call to testit failed with @error=" & @error & @CRLF) EndIf Finally, I use interop within my C# class to get at Windows things. So do I declare the method somehow as interop , the whole class, or what? Anybody got any ideas? Regards, Jim Edited July 16, 2008 by obrienj Link to comment Share on other sites More sharing options...
obrienj Posted July 16, 2008 Author Share Posted July 16, 2008 I went searching for information on calling C# class libraries from C for example, and it appears to be the proverbial barrel of snakes. Lots of stuff about GUIDs and registering and so forth. So I'm going to guess that this may also be true about doing this from AutoIt. If anyone has any informaiton to the contrary, I would love to hear it. In the meantime, I think I'll try another approach. Regards, Jim Link to comment Share on other sites More sharing options...
Richard Robertson Posted July 16, 2008 Share Posted July 16, 2008 You can't call .Net through AutoIt very well right now. If you change your dll to export a COM object and register it correctly, you can just call the object through COM. 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