matwachich Posted March 8, 2013 Share Posted March 8, 2013 Hi! I have a question: - Why the hell would an application crash when I launch it from windows explorer, and works all fine when I launch it from command prompt????? More details: - It's an app that uses a DLL written in pure C of mine - The app also runs well when launched from SciTE (think it's a problem with the stdout...) - The module concerned in the crash is msvcrt.dll - All parts of the dll (event external libraries) are compiled using the same GCC (no any .NET sh*t) - Not only with AutoIt, even if I try to use this DLL with FreeBasic, I have the same crash - Befor, the DLL was not crashing this way, but I made many changes (and I didn't tracked them) since the last good version, so I have no idea where it comes from Big thanks! Link to comment Share on other sites More sharing options...
funkey Posted March 8, 2013 Share Posted March 8, 2013 I cannot see what's wrong without code, but once I had the same problem with an app not a DLL ritten in C. Problem was that the command line was different when starting the app from windows than starting the app from console. I parsed the app for first command line parameter (the path) and on console it was only 'app.exe' and in windows it was 'C:app.exe'. Something like that. matwachich 1 Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
matwachich Posted March 8, 2013 Author Share Posted March 8, 2013 Thanks! But I don't think the problem is here, because I don't make any use of cmd line params in the dll nor in the app using the dll. The code... first It's verry huge! (a total of 11370 lines with 6470 lines of code), and secondly, I don't yet know if I will release the code... It's a DLL in pure C, using as external libs: GLFW, SOIL and inih It's Object Oriented Syntax but with C. I mean all data structures are in opaque structs (only the dll know the members) and they are handled by the user with functions like: Sprite_Create (allocation), Sprite_Destroy (free), Sprite_SetPos, Sprite_GetPos ... Gonna fill the functions with printf and test! Link to comment Share on other sites More sharing options...
matwachich Posted March 8, 2013 Author Share Posted March 8, 2013 Problem solved! Thanks to the printf function! It was a not-completly initialized struct: - I allocate a sort of global and internal struct that contains many internal informations. One of these informations is a flag (0/1) to say if a Render Window is opened. This flag was not initialized to 0 when creating th structure. - When I call the OpenWindow function, this function checks the flag to see if it should open a window or not. And here was the problem (the flag wasn't initialized) What I don't understand yet (although my problem was solved by initializing the flag to 0) is why this caused problem only when launching the application from Windows Explorer??? Thanks for who readed me! Link to comment Share on other sites More sharing options...
Richard Robertson Posted March 9, 2013 Share Posted March 9, 2013 Different program subsystems may or may not initialize values differently. You should never rely on uninitialized values because this sort thing can happen. matwachich 1 Link to comment Share on other sites More sharing options...
Shaggi Posted March 10, 2013 Share Posted March 10, 2013 Why create an oop c system, when there is an obvious alternative... If you run the code in debug mode, your debugger should tell you, that youre accessing uninitialized variables. trancexx 1 Ever wanted to call functions in another process? ProcessCall UDFConsole stuff: Console UDFC Preprocessor for AutoIt OMG Link to comment Share on other sites More sharing options...
matwachich Posted March 10, 2013 Author Share Posted March 10, 2013 What alternative? Link to comment Share on other sites More sharing options...
Richard Robertson Posted March 11, 2013 Share Posted March 11, 2013 C++. OOP on top of C. Link to comment Share on other sites More sharing options...
matwachich Posted March 11, 2013 Author Share Posted March 11, 2013 But by doing this, it will not be usable with AutoIt, which my first goal! And I don't know why (perhaps because I don't master it) but I don't like C++ I'm also doing a FreeBasic wrapper to my engin, and It uses Classes I'm near to release this engin, I just want to make a proper errors handling for it, and also (and this is the boringest thing ever!) a proper documentation (about 300 function!!!) Link to comment Share on other sites More sharing options...
Richard Robertson Posted March 13, 2013 Share Posted March 13, 2013 AutoIt works fine with C++ dlls if you understand name mangling. Link to comment Share on other sites More sharing options...
matwachich Posted March 17, 2013 Author Share Posted March 17, 2013 How can AutoIt use C++ classes??? And if it is just for making simple, standard functions, I prefer staying with C Link to comment Share on other sites More sharing options...
trancexx Posted March 18, 2013 Share Posted March 18, 2013 How can AutoIt use C++ classes???And if it is just for making simple, standard functions, I prefer staying with C Every virtual class method/function is accessible by DllCallAddress() or ObjCreateInterface() for example. Number of other "ways" exist. ♡♡♡ . eMyvnE 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