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

Making DLLEXPORT functions visible from C++ DLL

ovz
Beginner
1,088 Views

I'm building a C++ DLL that links some Fortran static libraries. My environment is

Visual Studio 2012

Intel(R) Visual Fortran Compiler XE 13.1.1.171

Fortran libraries export some functions e.g.

      logical function example_function()
      !DEC$ ATTRIBUTES DLLEXPORT :: example_function

      example_function = .true.
      return
      end

When I build my C++ dll example_function does _NOT_ show up in the exports. If I add a call to this function from DllMain I get the symbol exported. What is the proper way to export Fortran functions in this configuration?

 

extern "C" SSSPM_EXPORT bool C_FORT_CONV example_function_();

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
					 )
{
  example_function_();

 

 

0 Kudos
1 Solution
Steven_L_Intel1
Employee
1,088 Views

If it's in a library, it won't get linked in unless there's a reference. You can add the function name to Linker > Input > Force Symbol References. Maker sure it is spelled with the correct case and decoration.

View solution in original post

0 Kudos
1 Reply
Steven_L_Intel1
Employee
1,089 Views

If it's in a library, it won't get linked in unless there's a reference. You can add the function name to Linker > Input > Force Symbol References. Maker sure it is spelled with the correct case and decoration.

0 Kudos
Reply