Create a DLL

Create a DLL

Hello Steve,

I want to create DLL of my fortran.f90 code. This code contains main program and subroutines, the structure is as follows:

program ABC
..
..
end program ABC

subroutine XYZ
..
..
end subroutine XYZ

subroutine PQ
..
..
end subroutine PQ

I have learnt that, we can add the code '!DEC$ ATTRIBUTES DLLEXPORT :: [subroutine_name]' and create a DLL for subroutines, but how can I do for the main program ABC?

Also when I try to use the above code for subroutines and build my solution, DLLs don't get created in my working folder. I dont know where am I going wrong.

Could you please help me in solving this? Any information would be greatly appreciated! Thanks in advance.

publicaciones de 5 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

A Program unit cannot be in a DLL. A program unit creates an .EXE file not a .DLL file.
A DLL is made up of subprograms callable from other DLLs or other .EXE programs.

You are correct in having to EXPORT subprogram names in order for a list of callable subroutines to be created alongside the DLL, otherwise the subroutine names will not be visible to  programs that load the DLL.
 

If you want to create a dll, you need to "new" a "Dynamic-link Library" project, then the output will be an .dll file when you build the solution. This project could not include the main program ("ABC" in your example).

Cita:

Anthony Richards escribió:

A Program unit cannot be in a DLL. A program unit creates an .EXE file not a .DLL file.

I think you mean "main program", not the much more general "program unit".

Ha ir  Ha ir  Ha ir ?

Inicie sesión para dejar un comentario.