Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. importing fortran dll's

importing fortran dll's

Scheduled Pinned Locked Moved Visual Basic
helpcsharpcomtutorialquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    alankrita
    wrote on last edited by
    #1

    Hi, Thank you all for ur answers.I tried working it out but there still is some problem.I tried the dllimport method but i still have an error saying that the entry point has not been found.this was using salford fortran .i was just wondering if all fortran compilers are compatible with .net platform.when i used the intel fortran 8.0 compiler i was not able to reference the fortran dll as well.the error was that it is not a valid dll or com object.i guess it cudnt recognise the dll.is there anything i can do to get it right?? the dllimport code i used was _ Public Shared Sub xyz(ByRef x As Integer) End Sub call xyz(x) and in the fotran dll i wrote the following subroutine Dll2(x) x=x+1 ! Expose subroutine Dll2 to users of this DLL ! !DEC$ ATTRIBUTES DLLEXPORT::Dll2 !MS$ATTRIBUTES REFERENCE :: x end subroutine Dll2 this is just an example i was trying to get right. i need to get it right soon. thank u for ur help

    D P 3 Replies Last reply
    0
    • A alankrita

      Hi, Thank you all for ur answers.I tried working it out but there still is some problem.I tried the dllimport method but i still have an error saying that the entry point has not been found.this was using salford fortran .i was just wondering if all fortran compilers are compatible with .net platform.when i used the intel fortran 8.0 compiler i was not able to reference the fortran dll as well.the error was that it is not a valid dll or com object.i guess it cudnt recognise the dll.is there anything i can do to get it right?? the dllimport code i used was _ Public Shared Sub xyz(ByRef x As Integer) End Sub call xyz(x) and in the fotran dll i wrote the following subroutine Dll2(x) x=x+1 ! Expose subroutine Dll2 to users of this DLL ! !DEC$ ATTRIBUTES DLLEXPORT::Dll2 !MS$ATTRIBUTES REFERENCE :: x end subroutine Dll2 this is just an example i was trying to get right. i need to get it right soon. thank u for ur help

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      It would appear that the .DLL is in a custom format that is not usuable outside the salford fortran runtime. There is nothing you can do to get it in the correct format, other than rewriting the code using the Intel FORTRAN compiler and having it create the .DLL in a standard format. I don't know this for sure, it's what I suspect... RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      1 Reply Last reply
      0
      • A alankrita

        Hi, Thank you all for ur answers.I tried working it out but there still is some problem.I tried the dllimport method but i still have an error saying that the entry point has not been found.this was using salford fortran .i was just wondering if all fortran compilers are compatible with .net platform.when i used the intel fortran 8.0 compiler i was not able to reference the fortran dll as well.the error was that it is not a valid dll or com object.i guess it cudnt recognise the dll.is there anything i can do to get it right?? the dllimport code i used was _ Public Shared Sub xyz(ByRef x As Integer) End Sub call xyz(x) and in the fotran dll i wrote the following subroutine Dll2(x) x=x+1 ! Expose subroutine Dll2 to users of this DLL ! !DEC$ ATTRIBUTES DLLEXPORT::Dll2 !MS$ATTRIBUTES REFERENCE :: x end subroutine Dll2 this is just an example i was trying to get right. i need to get it right soon. thank u for ur help

        P Offline
        P Offline
        progload
        wrote on last edited by
        #3

        You should check Salfords Site: http://www.salfordsoftware.co.uk/kb/SKB146 Calling routines in object files/DLLs created by other compilers This applies to: Salford C/C++ DBOS Salford C/C++ Win32 Salford FTN77 DBOS Salford FTN77 Win32 Salford FTN90 DBOS Salford FTN90 Win32 Salford FTN95 DBOS Salford FTN95 for Visual Studio .NET Salford FTN95 Win32 Question Is it possible to call routines in object files/DLLs created by other compilers? Answer Yes using C_EXTERNAL or STDCALL. See the Mixed Language Programming section in the User Guide. -------------------------------------------------------------------------------- THE INFORMATION IN THIS DOCUMENT IS PROVIDED ON AN AS-IS BASIS WITHOUT WARRANTY OF ANY KIND. PROVIDER SPECIFICALLY DISCLAIMS ANY OTHER WARRANTY, EXPRESS OR IMPLIED, INCLUDING ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL PROVIDER BE LIABLE FOR ANY CONSEQUENTIAL, INDIRECT, SPECIAL OR INCIDENTAL DAMAGES, EVEN IF PROVIDER HAS BEEN ADVISED BY USER OF THE POSSIBILITY OF SUCH POTENTIAL LOSS OR DAMAGE. USER AGREES TO HOLD PROVIDER HARMLESS FROM AND AGAINST ANY AND ALL CLAIMS, LOSSES, LIABILITIES AND EXPENSES. Document ID: SKB0146 Published on: 12 Feb 2004

        1 Reply Last reply
        0
        • A alankrita

          Hi, Thank you all for ur answers.I tried working it out but there still is some problem.I tried the dllimport method but i still have an error saying that the entry point has not been found.this was using salford fortran .i was just wondering if all fortran compilers are compatible with .net platform.when i used the intel fortran 8.0 compiler i was not able to reference the fortran dll as well.the error was that it is not a valid dll or com object.i guess it cudnt recognise the dll.is there anything i can do to get it right?? the dllimport code i used was _ Public Shared Sub xyz(ByRef x As Integer) End Sub call xyz(x) and in the fotran dll i wrote the following subroutine Dll2(x) x=x+1 ! Expose subroutine Dll2 to users of this DLL ! !DEC$ ATTRIBUTES DLLEXPORT::Dll2 !MS$ATTRIBUTES REFERENCE :: x end subroutine Dll2 this is just an example i was trying to get right. i need to get it right soon. thank u for ur help

          P Offline
          P Offline
          progload
          wrote on last edited by
          #4

          And Here: Calling a Salford FTN95 DLL from Microsoft Visual Basic This applies to: Salford FTN95 Win32 Summary Calling routines in a dynamic link library created with Salford FTN95 from a Microsoft Visual Basic application. Solution An FTN95 DLL that is called by an executable that uses the STDCALL calling convention (e.g. one created using Win32 Visual Basic) must use F_STDCALL in the declaration of all exported subprograms. For example, F_STDCALL FUNCTION F(X) INTEGER F,X F=X END Such a function could make calls to Windows API functions provided an interface is provided via, for example, "USE MSWIN" or "INCLUDE ". Alternatively an interface for each API function can be given explicitly. For example, STDCALL SENDMESSAGE 'SendMessageA' (VAL,VAL,VAL,VAL):INTEGER*4 A call is automatically made to a DLL function called LIBMAIN when the DLL is loaded. If you do not provide a definition of LIBMAIN then SLINK will provide a default for you. LIBMAIN is used to initialise global data. It takes the following form. F_STDCALL INTEGER FUNCTION LIBMAIN(hInst,ul,lpR) INTEGER hInst,ul,lpR !***** Initialise global data here LIBMAIN=1 END A simple SLINK script would take the form: dll lo f95.obj exportall file c:\windows\f95.dll A Visual Basic program can use calls to the API functions LoadLibrary and FreeLibrary in order to ensure that the DLL does not unload whilst a Visual Basic form is loaded. Here is some sample code for this purpose. Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal s As String) As Long Private Declare Function FreeLibrary Lib "kernel32" (h As Long) As Long Dim hLibModule As Long Private Sub Form_Load() hLibModule = LoadLibrary("f95.dll") End Sub Private Sub Form_Unload(Cancel As Integer) i& = FreeLibrary(hLibModule) End Sub -------------------------------------------------------------------------------- THE INFORMATION IN THIS DOCUMENT IS PROVIDED ON AN AS-IS BASIS WITHOUT WARRANTY OF ANY KIND. PROVIDER SPECIFICALLY DISCLAIMS ANY OTHER WARRANTY, EXPRESS OR IMPLIED, INCLUDING ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL PROVIDER BE LIABLE FOR ANY CONSEQUENTIAL, INDIRECT, SPECIAL OR INCIDENTAL DAMAGES, EVEN IF PROVIDER HAS BEEN ADVISED BY USER OF THE POSSIBILITY OF SUCH POTENTIAL LOSS OR DAMAGE. USER AGREES TO HOLD PROVIDER HARMLESS FROM AND AGAINST ANY AND ALL CLAIMS, LOSSES, LIABILITIES AND EXPENSES. Document ID: SKB0169 Published on: 19 Feb 2004

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups