- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I wrote a DLL using Compaq VF that I was able to call from an Excel VBA, and it worked fine (using windows XP, Excel 2003). However, when I transitioned to Vista / Excel 2007, I had to switch to Intel VF; now it doesn't work
I traced the problem to the DLL, which allit does is call a subroutine with a somewhat complex argument list: 1 char string, 2 integers, 1 array of real values, and2 arrays of strings. I had it all wokring previously, so I think that the compiler directives are correct. Below is the actual subroutine, which worked fine with CVF:
SUBROUTINE XLS2MYSUB(ifil,charinput,nlines,ncols,dc_dpou,dc_chou)
!
!-----------------------------------------------------------------------
! Compiler directives to export DLL
!DEC$ ATTRIBUTES DLLEXPORT,STDCALL :: XLS2MYSUB
!DEC$ATTRIBUTES ALIAS: 'XLS2MYSUB'::XLS2MYSUB
!DEC$ ATTRIBUTES REFERENCE :: ifil,charinput,nlines,ncols,dc_dpou,
& dc_chou
!
!-----------------------------------------------------------------------
! Parameter Definition
CHARACTER*200 ifil
INTEGER nlines,ncols,i
CHARACTER (LEN=200) charinput(nlines)
CHARACTER (LEN=15) dc_chou(20)
DOUBLE PRECISION dc_dpou(20,2)
!-----------------------------------------------------------------------
! Begin Code
! Set the maximum number of data items per line
ncols = 50
dc_dpou(1,1) = 999.999
!-----------------------------------------------------------------------
! Call MYSUB
!CALL MYSUB_SUB(ifil,charinput,nlines,ncols,dc_dpou,dc_chou)
!
!-----------------------------------------------------------------------
! Finished
END SUBROUTINE
!
So this returns the value of 999.999 to the Excel VBA without a problem.The actual call to the subroutine MYSUB_SUB was commented to isolate the problem, if I uncomment it, it stops working. So,I wanted to debug the arguments passed from the excel by writing them outto a file, but it seems I can't do something as simple as openinga file from the DLL, Iusedthe following lines:
open(unit=10,form='formatted',file='C:\temp\junk.dat')
write(10,*) ifil
close(10)
Iknow the above lines work becase I used them sucessfullyback onthe XP side.Is there something fundamentally different in the compiler directives between CFV and IVF? Why does the DLL stop working when I try to open a file? (it works with XP)
David
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page