×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Calling Fortran Compiled dll from Excel VBA 453 error

Calling Fortran Compiled dll from Excel VBA 453 error

Calling Fortran Compiled dll from Excel VBA 453 error

(OP)
Hi,

I am having trouble getting Excel 2002 VBA to call a dll complied with MinGW Fortran complier.  Any help on this particular problem and/or general places to go for help on this matter would be much appreciated.

Here is the Fortran Code I used:
============================================
      subroutine DAE(xx,yy)
    !DEC$ ATTRIBUTES DLLEXPORT::DAE
    !DEC ATTRIBUTES ALIAS"'DAE'::DAE
      xx=yy+2005
      end
===========================================

Complied with the following commands:

g77 -O2 -c HELL.f
dllwrap --export-all-symbols HELL.o -o HELL.dll

Here is the VBA code that I used:

=======================================
Public Declare Sub DAE Lib "C:\Fortran\hell.dll" (xx As Single, yy As Single)
Option Explicit

Sub CellToApplication()
Dim xx, yy As Single
xx = 31
yy = 13
Call DAE(xx, yy)
Range("B5").Value = xx
End Sub
=================================

The error I get is:
Can't find the DLL entry point DAE in C:\Fortran\hell.dll
 
Thank you,

Rob

RE: Calling Fortran Compiled dll from Excel VBA 453 error

Windows DLLs are acutally programs.  They need a routine called DLLMain.  The C++ interface to it is

CODE

extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
No entry point means DllMain is missing.  The problem here is that it is case sensitive.  I don't have dllwrap so I can't see what it is actually doing.  Try nm on hell.dll.  See if DllMain is one of the routines listed.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources