Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28951 Discussions

Regsvr32 LoadLibrary Fails - Can't Find Procedure

Cliff_Phares
Beginner
2,091 Views
Hello All:

I've built a DLL called fStatistics using IVF 11.1.048 inVS2005.
It includes static libraries fDebug and fNumbers8 and
regsvr32 cannot load it.

Both static libraries are built using the following compile command line (line delimited by me):
/nologo /fixed
/warn:declarations /warn:unused /warn:interfaces /names:as_is
/module:"Release\"
/object:"Release\"
/libs:dll /threads/libdir:noauto /libdir:nouser /c

The static library link lines are
/OUT:"Release/fNumbers8.lib" /NOLOGO
/OUT:"Release/fDebug.lib" /NOLOGO

The static library*.lib files are copied to folder %DDslib%.
The static library *.mod files are copied to folder %DDinclude%.

For the dynamic library fStatistics, I've added the static libraries to the project and
specified$(DDinclude) as an additional include directory.

For the DLL, the fortran compile line is :
/nologo/I"C:\Program Files\DuPont\include"/fixed
/warn:declarations /warn:unused /warn:interfaces /names:as_is
/module:"Release\"
/object:"Release\"
/libs:dll /threads /libdir:nouser /c

For the DLL, the link command line is:
/OUT:"Release\fStatistics.dll" /NOLOGO
/MANIFEST /MANIFESTFILE:"C:\...\fStatistics\fStatistics\Release\fStatistics.dll.intermediate.manifest"
/SUBSYSTEM:WINDOWS
/IMPLIB:"C:\...\fStatistics\fStatistics\Release\fStatistics.lib" /DLL

I copy the lib and the dll file to folder %DDdlib%.

From the command prompt fromdirectory C:\Program Files\DuPont\DLIB,
I see the newly created fStatistics.lib and fStatistics.dll files.

> Regsvr32 fStatistics.dll returns the error message
LoadLibrary ("fStatistics.dll") failed - The specified procedure could not be found

What am I doing wrong ?

Thanks,
Cliff
0 Kudos
1 Solution
Steven_L_Intel1
Employee
2,091 Views
Does your DLL include DllRegisterServer and DllUnregisterServer routines, properly exported? If not, what do you expect to happen when you use Regsvr32?

View solution in original post

0 Kudos
4 Replies
Paul_Curtis
Valued Contributor I
2,091 Views

Absent a complete path specification, LoadLibrary looks for .dll files in the directory where the .exe is located. Your other pathing relates to how your project is built, not what happens when it runs.
0 Kudos
g_f_thomas
Beginner
2,091 Views
Quoting - Cliff Phares
Hello All:

I've built a DLL called fStatistics using IVF 11.1.048 inVS2005.
It includes static libraries fDebug and fNumbers8 and
regsvr32 cannot load it.

Both static libraries are built using the following compile command line (line delimited by me):
/nologo /fixed
/warn:declarations /warn:unused /warn:interfaces /names:as_is
/module:"Release"
/object:"Release"
/libs:dll /threads/libdir:noauto /libdir:nouser /c

The static library link lines are
/OUT:"Release/fNumbers8.lib" /NOLOGO
/OUT:"Release/fDebug.lib" /NOLOGO

The static library*.lib files are copied to folder %DDslib%.
The static library *.mod files are copied to folder %DDinclude%.

For the dynamic library fStatistics, I've added the static libraries to the project and
specified$(DDinclude) as an additional include directory.

For the DLL, the fortran compile line is :
/nologo/I"C:Program FilesDuPontinclude"/fixed
/warn:declarations /warn:unused /warn:interfaces /names:as_is
/module:"Release"
/object:"Release"
/libs:dll /threads /libdir:nouser /c

For the DLL, the link command line is:
/OUT:"ReleasefStatistics.dll" /NOLOGO
/MANIFEST /MANIFESTFILE:"C:...fStatisticsfStatisticsReleasefStatistics.dll.intermediate.manifest"
/SUBSYSTEM:WINDOWS
/IMPLIB:"C:...fStatisticsfStatisticsReleasefStatistics.lib" /DLL

I copy the lib and the dll file to folder %DDdlib%.

From the command prompt fromdirectory C:Program FilesDuPontDLIB,
I see the newly created fStatistics.lib and fStatistics.dll files.

> Regsvr32 fStatistics.dll returns the error message
LoadLibrary ("fStatistics.dll") failed - The specified procedure could not be found

What am I doing wrong ?

Thanks,
Cliff

Your DLL is either of the COM or regular variety. Only the first needs to be registered via regsvr32 so that registering a regular DLL is redundant. If the DLL is of the classic type then youthe Win API LoadLibrary which requires the DLL`s name as a C string. Use either DUMPBIN or the Depends utility to find out what the DLL exports areand it should be immediately evident whether you have a COM, whose interfaces are accessed with the help of the IVF COM Wizard, or a regular DLL, whose exports are accessed via the API in conjunction with integer pointers, on your hands.
0 Kudos
Steven_L_Intel1
Employee
2,092 Views
Does your DLL include DllRegisterServer and DllUnregisterServer routines, properly exported? If not, what do you expect to happen when you use Regsvr32?
0 Kudos
Cliff_Phares
Beginner
2,091 Views
Does your DLL include DllRegisterServer and DllUnregisterServer routines, properly exported? If not, what do you expect to happen when you use Regsvr32?

Thanks Steve. I had other problems as well. But I'll start a new thread for those.

When I compiled my fStatistics as a static library,
I used Fortran > Libraries > RunTime Library = Multithread DLL (/libs:dll /threads).

I think the libs:dll triggered the directives:
!DEC$ IF DEFINED (_DLL)
!DEC$ ATTRIBUTES DLLEXPORT, DEFAULT :: fSTAT_StDev
!DEC$ ATTRIBUTES ALIAS:'fSTAT_Stdev' :: fSTAT_StDev
!DEC$ ATTRIBUTES REFERENCE :: N
!DEC$ ATTRIBUTES REFERENCE :: X
!DEC$ ATTRIBUTES REFERENCE :: Mean
!DEC$ ATTRIBUTES REFERENCE :: UnBiasedIfOne
!DEC$ ENDIF

When I tested the fStatistics static library in a fortran console program,
I kept getting link error unresolved symbol _imp_fSTAT_StDev.

While I haven't yet rebuilt fFTSD with the newly rebuilt fStatistics static library,
I know that fStatistics static library works.

The issue I have now is around best practices for using system libraries in my static library and dynamic library builds. But I'll start another thread for that one.

Thanks much for your help.
0 Kudos
Reply