Author Topic: GetProcAddress  (Read 2958 times)

Offline Berion

  • Single posting newcomer
  • *
  • Posts: 5
GetProcAddress
« on: October 15, 2006, 11:38:21 am »
I made a simple test dll with on exported function.

LoadLibrary worked, but I couldn't load the function with GetProcAddress().

I searched in this forum and found that I should use the name of the function in the .def file.

Now it works, but the function is called something like _Z4Testv instead of Test.

Now I have some questions:

Is there a way to use the real name?
Will the name change?

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: GetProcAddress
« Reply #1 on: October 15, 2006, 01:55:05 pm »
Makes me wonder how that is related to Code::Blocks... this is actually a Win32 specific programming question.

Anyway, GetProcAddress() failing is most often due to name mangling, i.e. a forgotten extern "C" in your code.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Berion

  • Single posting newcomer
  • *
  • Posts: 5
Re: GetProcAddress
« Reply #2 on: October 15, 2006, 04:32:48 pm »
thanks

I posted it here because the last time I worked with it was with vc++ and there it worked. Not the same code.