- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
I have an example program that compiles and links just fine. It has one module with three program that I want to make into a DLL. I made an interface module that defines the interface to these three subroutines. I set up two Visual Studio projects that could only see the part that they need. One generates a DLL file just fine, but the one the the driver and interface modulecannot find the subroutines. What do I need to add to the Visual Studio properties or code to find and open the DLL?
コピーされたリンク
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
If the executable project also needs to see the modules from the DLL, add the DLL project's output folder (Debug or Release) to the "Additional INCLUDE paths" list in the executable project's Fortran property page.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Thanks Steve,
I used the DUMPBIN utility to look at the symbols. It turned out that the symbols in the DLL were generated with a module name preface and the procedure that was using the DLL didn't expect the module name preface. I did have the interface declarations in a module with the same name, but that appearantly didn't pass through.
Is there a simple way to get the module with the interface declarations to associate the module name with the subroutines?
Mattsdad
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
I thought I did that like this:
MODULE
My_DLLCONTAINS
SUBROUTINE XXX() !DEC$ ATTRIBUTES DLLEXPORT :: XXX ! ... END SUBROUTINE XXX()END MODULE
My_DLLPROGRAM
Main() USE My_DLL ! ... CALL XXX() ! ...END
PROGRAM MainThe Main procedure compiled and linked just fine whenMy_DLL was in the same project, compiled together with the module.
The project with the main routine was modified to add an interface module when My_DLL was separated to another project.
MODULE
My_DLL INTERFACE SUBROUTINE XXX() !DEC$ ATTRIBUTES DLLIMPORT :: XXX END SUBROUTINE XXX() INTERFACEEND MODULE
My_DLLSo what do you mean by "USE the module"?
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
What I meant was to USE MY_DLL with it seeing the .mod from the build of the DLL project, not a different one in the executable project. That way it will see the correct definition.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Yes - just add a DLLEXPORT directive for the module-level variable and it will be "imported" when the module is USEd. There is an example of this provided in sample DLL_Shared_Data.
Steve
