tags:

views:

60

answers:

1

I found many ways, but they are too easy, they always get a return-value from the dll file.

dll file: a file with the sufix ".dll"

+3  A: 

It's just like any other WINAPI

// assuming you are using windows
LPCTSTR lpszXml = _T("<xml> </xml>");
TCHAR szResult[1000] = _T("");
HMODULE hModule = LoadLibrary(_T("mylibrary.dll"));
int (*DoWorkFunc)(LPCTSTR lpszXmlData,LPTSTR lpszResult, cchMaxSize);

*(FARPROC*)&DoWorkFunc = GetProcAddress(hModule, _T("DoWork"));
int nLength = DoWorkFunc(lpszXml,szResult,1000);
_tprintf(_T("input [%s] output [%s] length of the result [%d]\n")
         ,lpszXml,szResult,nLength);

FreeLibrary(hModule);
// warning: no error handling

Edit:
Since I speak multiple-languages, I can roughly guess what the OP asked. It is probably along this line:

I found many ways [in the internet] to load a DLL file and call a function inside it. But those that I found involve simple functions like int add(int a, int b). They only get a return value from the function. What I want to do is to pass a big chunk of data and get another big chunk of data from the function. How can I pass a big chunk of data and get a big chunk of data as the return value?

afriza
thank you. I know too little of the C programming.
Keating Wang