Richard Robertson Posted January 1, 2007 Share Posted January 1, 2007 Is there any way I can get more detailed information as to why my dll cannot be opened? I have written a Windows DLL in C++ and DllOpen is failing with a -1 return value. This doesn't tell me why it didn't work. Link to comment Share on other sites More sharing options...
Valik Posted January 1, 2007 Share Posted January 1, 2007 Call GetLastError(). Link to comment Share on other sites More sharing options...
Richard Robertson Posted January 1, 2007 Author Share Posted January 1, 2007 Heh, I didn't think of that. I'll sort that out and see what happens. Link to comment Share on other sites More sharing options...
Richard Robertson Posted January 1, 2007 Author Share Posted January 1, 2007 I tried it, got a 126, which meant it couldn't find it, so I relocated some files. I fixed that and got a 6, which means it is an invalid handle. This doesn't help me. Link to comment Share on other sites More sharing options...
/dev/null Posted January 1, 2007 Share Posted January 1, 2007 I tried it, got a 126, which meant it couldn't find it, so I relocated some files.I fixed that and got a 6, which means it is an invalid handle. This doesn't help me.can you post the DLL?CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
Richard Robertson Posted January 1, 2007 Author Share Posted January 1, 2007 It is a dll I have custom written to tackle the managed code calling. It is a standard WIN32 dll.http://freehost07.websamba.com/goobco/netinterop.dllI can provide source if necessary. Link to comment Share on other sites More sharing options...
/dev/null Posted January 1, 2007 Share Posted January 1, 2007 It is a dll I have custom written to tackle the managed code calling. It is a standard WIN32 dll.http://freehost07.websamba.com/goobco/netinterop.dllI can provide source if necessary.get a copy of "PE Explorer" and have a look at your exported symbols.CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
Richard Robertson Posted January 1, 2007 Author Share Posted January 1, 2007 I have the PE Explorer already, but how do I know what the exports are? I've only used it to get resources. Using the dependency walker, I see all the functions are listed as exported symbols. It isn't calling the functions that is the problem though, it is the loading of the dll. Link to comment Share on other sites More sharing options...
/dev/null Posted January 1, 2007 Share Posted January 1, 2007 (edited) I have the PE Explorer already, but how do I know what the exports are? I've only used it to get resources.Ctrl+E in "PE Explorer"Using the dependency walker, I see all the functions are listed as exported symbols.It isn't calling the functions that is the problem though, it is the loading of the dll.1.) I can load the DLL without errors with AU3 3.2.2.0. As I don't know how DllLoad is implemented (most certainly via LoadLibrary()) I can't tell you exactly what the problem is with your error code "6".2.) Even if you can load the DLL you will get into trouble when you try to call the exported functions, as you exported them with the C++ decorated names. Again, I don't know how DllCall is implemented, but I don't think that DllCall will handle all the different decoration styles of the various C++ compilers. Read this: http://en.wikipedia.org/wiki/Name_manglingBTW: If you can't figure it out, post the code and a description how you compiled the DLL.CheersKurt Edited January 1, 2007 by /dev/null __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
Valik Posted January 2, 2007 Share Posted January 2, 2007 1.) I can load the DLL without errors with AU3 3.2.2.0. As I don't know how DllLoad is implemented (most certainly via LoadLibrary()) I can't tell you exactly what the problem is with your error code "6".It may be a leftover error code from some other function call. IceKirby will need to check that the DLL actually loaded okay by checking the return value of DllOpen().2.) Even if you can load the DLL you will get into trouble when you try to call the exported functions, as you exported them with the C++ decorated names. Again, I don't know how DllCall is implemented, but I don't think that DllCall will handle all the different decoration styles of the various C++ compilers.There's no magic to it. To use the functions, you call them by whatever name they are exported as. For example, to call Delete(), you would pass "?Delete@@YAXH@Z" to DllCall().IceKirby, I see no reason the DLL won't load unless you've implemented DllMain() wrong or something. Link to comment Share on other sites More sharing options...
Richard Robertson Posted January 2, 2007 Author Share Posted January 2, 2007 In DllMain, all it does is initialize a static variable on process attach. DllOpen was returning -1. I didn't know I would need to call the weird names. How do I export names like "Delete"? I don't recall if I was testing before upgrading or after, so I will try again now that I know it is upgraded. Link to comment Share on other sites More sharing options...
Valik Posted January 2, 2007 Share Posted January 2, 2007 You'll probably want to make all the functions use __stdcall (WINAPI) for their calling convention or you'll need to specify cdecl with AutoIt when you use DllCall(). As for exporting the symbols, I usually use a definition file but there are other ways. MSDN can show you a couple different ways. Link to comment Share on other sites More sharing options...
Richard Robertson Posted January 2, 2007 Author Share Posted January 2, 2007 I forgot about __stdcall. I'll fix those and try again. 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