Greetings.

My question is with regard to performance optimization with respect to calling routines in a C DLL from a VB6 application. I have created a small C DLL that includes math functions that take advantage of bit shifting in C. To test the performance of the C routines, I setup a loop that cycles N times, each time through the loop I call a C routine of interest.

Here is the nutty part: If I run a timing test out of the VB Run-time environment, I am able to call a function, ABC (written in C), in ~8 seconds (for the N cycles). Then, I build an EXE (actually, an SCR) from the VB. I run this and the same cycling takes ~9.5 seconds. Can anyone offer an explanation, and better still, what I can do to make the performance of the EXE match that of the VB run-time environment?

Notes:
1. The DLL is ~40 K, compiled with Speed Optimization, no MFC.
2. The DLL contains ~10 routines.
3. N = 1,000,000.

Thoughts & more questions:
1. Does the order of the routines in the .DEF file have an impact?
2. Would using the routine's Ordinal position in the VB Declare have a benefit?
3. Is there some tool / method that can be used to build the C DLL into the VB built EXE?

Thanks much in advance.