Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


GetProcAddress Not Owrking in Release Mode!?

This topic is 5887 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i can compile the library in release mode, and my app finds all the functions BUT ONLY IN DEBUG MODE. as soon as i try to use the un-modded code in release mode, GetProcAddress returns NULL (fails) heres the Library code:
#define EXPORT_FUNCTION extern "C" __declspec(dllexport)

using namespace std;
vector<script_variable*> curVars;
EXPORT_FUNCTION int SetVariables(script_variable *vars)
	return 1;

EXPORT_FUNCTION int CL_DLLTest(script_function *F)
	F->call_return.type = F_INT;
	return 1;
EXPORT_FUNCTION int init(int read,int write)
	printf("CLi LibTest.dll Init!\n");
	return 1;
this is the App side source
typedef int (*F_LIBINITF) ( int read_pipe,int write_pipe);
typedef int (*F_LIBFUNC_NP) ( script_function*F);
typedef int (*F_LIBSETVAR) ( script_variable*F);

// loading function ...

	unsigned int &sz = scLibs[_cur].f_count;			
	scLibs[_cur].functions_np[sz] = (F_LIBFUNC_NP) GetProcAddress((HMODULE) scLibs[_cur].hLib, libOpp);
	string_t namp = libOpp;
	scLibs[_cur].functions_names[sz] = namp.line;

	  printf("Error Loading Function [%s]\n",libOpp);
	  scLibs[_cur].f_count--; // remove this one

	} else {
	printf("Loaded Function [%s]\n",libOpp);
// end ...


Share this post

Link to post
Share on other sites
possibly the dll you are trting to load the functions from is not being loaded. why not make sure the dll is loaded before blaming GetProcAddress() since i have had it only fail on two occasions.
1. dll was not loaded due to the wrong path given to LoadLibrary()
2. function was not exported/forgot to use extern C{}

seems like number 1 is happneing to you.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!