Software Archive
Read-only legacy content
17061 Discussions

Fortran DLL not returning data

Gerrit_V_1
Beginner
404 Views

Problem:
I am porting a program with VB6 UI + Compac DLL to VB.NET 2013 + Intel Fortran (11.1) DLL
A small dummy program, in VS 2 projects (UI and DLL), works fine, i.e.:
- data input in UI
- data changed in DLL
- changed data displayed in UI

I'm using the following configuration:
- VS 2013
- Intel Frotran 11.1 for windows
- IMSL 7-1

When I replace the UI by the UI of the target program, but keep the interface to the DLL
and the DLL the same as in the dummy program:
- I can debug the DLL: so the interface is ok,
- but data changed in the DLL is not returned to the UI
- property pages are kept the same

Any suggestion what the cause might be, is highly appreaciated.

0 Kudos
5 Replies
Georg_Z_Intel
Employee
404 Views

Hello,

is the question related to the debugger as you cannot display the data returned from a DLL in the watch window?
Or is this a general question to why passing data via DLLs does not work in your setup?

In any case it would help me and others if you could provide a stripped down example demonstrating the problem.

Thank you & best regards,

Georg Zitzlsberger

0 Kudos
Gerrit_V_1
Beginner
404 Views

Hi Georg,

Thanks for responding. I will prepare a small demo. What I noticed in the meantime is that data are returned from the dll if the parameters are packed in an array, so basically there is a solution. But I don't understand why a single or integer parameter is not returning a value when changed in the dll.

Best Regard,

Gerrit Verboom

0 Kudos
Gerrit_V_1
Beginner
404 Views

Hi Georg,

Please find attached a small VS solution of a VB UI and an Intel DLL.

The value of AB (single) is changed in the DLL, but not returned to the UI.

When changed to a one-element array, the value is return to the UI.

Looking forward to your remarks.

Best regards,

Gerrit

0 Kudos
Georg_Z_Intel
Employee
404 Views

Hi Gerrit,

this ain't a debugger question but a general VB to Fortran interfacing question.

Please use "ByVal ab As Single" and not "ByRef ab As Single".

Best regards,

Georg Zitzlsberger

0 Kudos
Gerrit_V_1
Beginner
404 Views

Hi Georg,

Thank you, this indeed solved my problem. I must update my understanding of ByVal versus ByRef.

Best regards,

Gerrit Verboom

0 Kudos
Reply