Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling Fortran Compiled dll from Excel VBA 453 error

Status
Not open for further replies.

felkin

Chemical
Feb 5, 2004
4
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
 
Replies continue below

Recommended for you

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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor