Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » small dli enhancement
small dli enhancement [message #39656] Sun, 14 April 2013 06:17
Shire is currently offline  Shire
Messages: 41
Registered: September 2006
Location: Russia, Yamal peninsula
Member
dli.h generates two global functions:
DLIMODULE() and DLIMODULE ## _()
First function has load .dll before return module pointer. Second function is just holder of static module variable.

There are many situations where additional module check is not necessary - for example, sequence of dll function calls, and DLIMODULE_() function is good for these situations. But it generates in source section, and compiler have to generate additional function call for each dll function call. I propose to move DLIMODULE_() to header section and make it inline:
 DLLTYPE& DLIMODULE();
-DLLTYPE& COMBINE(DLIMODULE, _)();
+inline DLLTYPE& COMBINE(DLIMODULE, _)()
+{
+	static DLLTYPE out;
+	return out;
+}

 #endif

 #ifdef DLI_SOURCE
 #undef DLI_SOURCE

-DLLTYPE& COMBINE(DLIMODULE, _)()
-{
-	static DLLTYPE out;
-	return out;
-}


This can avoid overhead for function call at every dll function invoke.
Previous Topic: SortedVectorMap compile error
Next Topic: stl-compatibility
Goto Forum:
  


Current Time: Fri Apr 19 21:29:11 CEST 2024

Total time taken to generate the page: 0.03523 seconds