Hi,
Ive written some functions in c++ wich i can call from a .dll in Blitz.
How do i return a string from the c++ function to a blitz variable.
C++ code:
Blitz code:
Ive written some functions in c++ wich i can call from a .dll in Blitz.
How do i return a string from the c++ function to a blitz variable.
C++ code:
#include <iostream> #include <fstream> #include <windows.h> using namespace std; char acUserName[100]; DWORD nUserName = sizeof(acUserName); __declspec( dllexport ) string getuser(); __declspec( dllexport ) int writeuser(); __declspec( dllexport ) int main(); int main() { getuser(); writeuser(); } string getuser() { GetUserNameA(acUserName, &nUserName); return acUserName; //return 0; } int writeuser() { ofstream myfile; myfile.open ("user.txt"); myfile << acUserName; myfile.close(); return 0; }
Blitz code:
result = CallDLL("GetUser","getuser") Print "Result= " + result WaitKey() End