ich möchte auf eine DLL mit Purebasic zugreifen.
Folgendes geht mit Codeblocks:
Code: Alles auswählen
#include "windows.h"
#include "stdio.h"
int main(){
// Define DLL functions
typedef double (WINAPI *AdresseSI)(char PropertyToReturn[20], char InputProperty1[20], double InputValue1, char InputProperty2[20], double InputValue2, char Refrigerant[20]);
// addresses
AdresseSI PropsSIAddress;
double result1;
// load DLL; change this path as needed
HINSTANCE CoolPropDll;
CoolPropDll = LoadLibraryA("CoolProp_32.dll");
if (CoolPropDll)
{
// addresses
PropsSIAddress = (AdresseSI) GetProcAddress(CoolPropDll, "_PropsSI@32");
// call function
if (PropsSIAddress)
{
result1 = (*PropsSIAddress) ("Dmass", "T", 298.15, "P", 101325, "R410A");
printf("R410A density: %g\n", result1);
}
// unload DLL
FreeLibrary(CoolPropDll);
}
else{
printf("Could not load CoolProp DLL.");
}
}
Code: Alles auswählen
PrototypeC.i Ergebnis(Wert1.p-unicode, Wert2.p-unicode, Wert3.d, Wert4.p-unicode, Wert5.d, Wert6.p-unicode)
datei.s="X:\purebasic\DLL-Datei-ana\CoolProp_32.dll"
If OpenLibrary(0, datei)
Test.Ergebnis=GetFunction(0, "_PropsSI@32")
Debug Test("Dmass", "T", 298.15, "P", 101325.0, "R410A")
EndIf
CloseLibrary(0)
Kann mir jemand helfen?
__________________________________________________
Code-Tags hinzugefügt
25.06.2018
RSBasic