Jump to content
  • Advertisement

Archived

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

Jess

DLLs

This topic is 5613 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

If I have a function in a dll, and this function is called by main program too much times (GLRender() the system gets the function code one time at begining, or every time it get the function of the dll. There are much overhead in DLL functions call?

Share this post


Link to post
Share on other sites
Advertisement
Assuming you retrieve the function address just once and not every time you call it, the difference between calling a function and calling one in a DLL should be negligible.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Once DLL is loaded there is NO difference. In-process DLL code is treated exactly as any function in main module. And as good doctor recommends save that pointer.

Share this post


Link to post
Share on other sites
Oh thanks!

Another question:

What is best way to use DLLs?
1. main.cpp and main.h with
main.h: __declspec(dllexport) int func();
main.cpp: __declspec(dllexport) int func() { return 1+1; }

out: main.dll and main.lib
in program that use the dll: link the main.lib and call the function normal: int main() { int n = func(); ... }
or

2. HINSTANCE hDLL = LoadLibrary("main.dll");
GetModuleFileName(....)
func = (cfunc)GetProcAddress((HMODULE)hDLL,"func");
int n = func();
FreeLibrary((HMODULE)hDLL);

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!