How can I call a dll form another dll written in cpp without it crashing on me

Hello guys!
I am new to the forum, I have a question which I posted on:
http://stackoverflow.com/questions/31514335/how-can-i-call-a-dll-form-another-dll-written-in-cpp-without-it-crashing-on-me
Everything is there.
*Moderators, I am new to this forum so I don't know the rules, so if you feel like I need to post the same thing on this forum please let me know, and don't lock this thread.
Other wise please feel comfortable answering where ever you like.
Thanks guys
Last edited on
If your application is crashing mid way through execution then you are definitely getting a runtime error; what does that error say? (Control Panel -> Administrative Tools -> Event Viewer: Application section). Please include that in your next post.

I don't know what "DllCall()" is from, are you certain that it is a variadic function?

Usually crashes like this occur because the function that the application was expecting to be avalible at runtime is not loaded into memory. There are a few things that you could try, the first one I would suggest is inserting a break point just before the suspected call and enumerating the DLL files that are loaded with either SysInternals 'Procmon' or the command line tool 'tasklist' like this:

 
tasklist /m /fi "imagename eq <PROCESS_NAME>"


with not triangle brackets of course.
Last edited on
Thanks for answering , I tried the Event Vierwer thing, but once I opened it, I couldn't find my processes, which is called DLLCall.au3 (which is an Autoit script that calls the dll) of course when the proccess was running.
I also tried the command you game me but this is what happned:
C:\Users\Nyname>tasklist /m /fi "imagename eq DLLCall.au3"
INFO: No tasks are running which match the specified criteria.

DllCall() is a function in Autoit that calls a dll, as mention in the original post. I now for a fact that the imgsearch.dll is loaded to memory properly because I get a msgbox
1
2
3
4
5
6
7
8
  hinstLib = LoadLibrary(TEXT("D:\\Downloads\\SmartGuy\\SmartGuy\\imgs\\imgsearch.dll")); 
 
    // If the handle is valid, try to get the function address.
 
    if (hinstLib != NULL) 
    { 
		std::cout << "DLL Called! Hello AutoIt!" << std::endl; // This silly function will just output in our Autoit script "Dll Called!"
      MessageBox(0, TEXT("hinstLib != NULL"), TEXT("Simple Dll..."),0);  //  

thanks
Last edited on
When you actually go to call the function, are you remembering to initialize the void pointer 'HBMP' so that it points to a space that was intentionally allocated for it with something like "memset(...)" "malloc()"? I only ask because you admit to being a 'noob' as you put it.
Last edited on
yea I just double checked and HBMP has a valid value.
And the buffer is large enough to contain the object populated by "ImageSearchEx()", right? 'void' pointers suck because they don't tell you anything.
Topic archived. No new replies allowed.