Hi, I've one dll that was made in Fortran. This dll contains the diynamic model of a Sailboat (in fact is a VPP -Velocity Prediction Program-)
In general, the inputs of the dll are 2 integers and 20 floats, as follows: (the name of the dll's function is "DLL_SIMULATEUR")
DLL_SIMULATEUR(int int, float, float ..., float)
the expected answer of the simulator is the same 22 variables in time + delta time.
I can use easily the dll in VB6 as follows:
--- function declaration ---
Private Declare Sub DLL_SIMULATEUR Lib "C:\vpp53.dll" (CodeError As Integer, n As Integer, t As Double, dt As Double, TWS As Double, TWA As Double, ec As Double, Ang As Double, _
X As Double, Y As Double, z As Double, psi As Double, teta As Double, phi As Double, _
Vx As Double, Vy As Double, vz As Double, omx As Double, omy As Double, omz As Double, Course As Double, Cap_Compass As Double, Leeway As Double, MomentSafran As Double)
--- call to dll ---
Call DLL_SIMULATEUR(CodeErreur, n, t, dt, TWS, TWA, ec, Ang, X, Y, z, psi, teta, phi, Vx, Vy, vz, omx, omy, omz, Course, Cap_Compass, Leeway, MomentSafran)
and the updated values are saved in the same variables,
for example, t <<time>>, if I send t=1, then after call the dll, t is going to be 2.
Another case. If I use it in matlab, the .h file is as follows:
where a0 is a ptr from matlab (i dont use it, but anyway, I must to put a variable to recive it), Input1, Input2, Val1 and Val2 are integers, and the rest, are doubles (in matlab, floats in C++)...
All that thing works fine, but, when I try to use the dll from VC++ (VS 2008), I can link the dll and send the data.. but I can't get the returned data.
The code in C++ that I'm using is:
// Test3.cpp*: définit le point d'entrée pour l'application console.
//
#include "stdafx.h"
#include "iostream"
#include <time.h>
#include <windows.h>
#include <winbase.h>
std::cout << "DLL Failed To Load!" << std::endl;
}
}
printf("Press any Key to Continue\n");
std::cin.get();
return 0;
}
It compiles fine (I know that it compiles doesn't means that it is going to work as i need xD)
but i can't get the updated values that are given by the dll.
What I'm doing wrong???
I'll be very happy if someone can help me.... I'm not good in c++ :S
Thanks a lot!
Miguel
one final remark: I dont have the .h either the .def of the function (as they are not used in VB and Matlab...)
Bookmarks