laconstantine 0 Junior Poster in Training

O.k guys the reason for the new thread because no one understood the previous thread even I didn't understand what I wrote lol!

Now listen to my problem.

I wrote an exe file that loads a dll and than uses a function from inside of the dll!

BUT!! my exe crashes while in runtime!! (runtime error)

Here is my exe code

/*Typedef the hello function*/
	typedef void (*pfunc)();  
	
	/*Windows handle*/
	HINSTANCE HandleDLL;
	
	/*A pointer to a function*/
	pfunc hello;
	
	/*LoadLibrary*/
	HandleDLL = LoadLibrary("message.dll");
	if (HandleDLL != 0)
    printf("MESSAGE library loaded!\n");
else
    printf("MESSAGE library failed to load!\n");

	/*GetProcAddress*/
	hello = (pfunc)GetProcAddress(HandleDLL,"hello");
	
	/*Call the function*/
	hello();

I think that the problem comes when I am calling the hello function..

Anyone has any ideas how to solve it??

Here is my dll source for more info

#if BUILDING_DLL
# define DLLIMPORT __declspec (dllexport)
#else /* Not BUILDING_DLL */
# define DLLIMPORT __declspec (dllimport)
#endif /* Not BUILDING_DLL */

DLLIMPORT void hello()
{ 
     MessageBox (0, "Hello from injected DLL!\n", "Hi", MB_ICONINFORMATION);
}

help anyone??

It should work!!!

please help!!