![]() |
Calling a C++ DLL in VB
I wasn't real sure which to put this in, so I figured C++, as that seems to be where the problem lies.
I was looking to have my webserver output to a timestamped log file instead of its log window, and instead of looking around for info on how to write to a file in VB (reading from a file I had to learn obviously, as it has to read the file and send it), I simply created a function in C++ to add a log line for me. Anyway, I'm getting this VB run-time error. "Can't find DLL entry point outfile in filestreamdll.dll". I have tried aliasing the function any way I found possible, utilizing any decoration in the .DLL/.LIB files ("?outfile@@YAHABVString@@0ABH@Z" being the total decoration I was able to find), but with any combination of decoration in there I still recieved the error message. For reference, I'll include any vital info here. This is my complete DllMain() function, as I didn't feel as though I needed any real initialization/deinitialization for it: :
BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {The only function's prototype (I enumerated app and trunc to 0 and 1, respectively): :
__declspec(dllexport) int outfile(const String &strOutString, const String &strFile, String being a standard class I used to make dynamic char arrays easier. The prototype to its relevant constructor is: :
String::String(const char * s);My attempt at calling the function from VB: :
Public Declare Function outfile Lib "filestreamdll.dll" _My attempt at actually utilizing the function from VB: :
outfile_return = outfile("Start Session @" & GetFormattedTime() & Chr$(10), _GetFormattedTime() returns a string with the date in it, formatted. If anything else is needed, just say so. |
Found my problem. I forgot to create a .def file in my project. I couldn't for the life of me find any way to edit my intial post to add "[solved]" to the title; maybe I'm just being blind, but if a mod could edit that or show me where the edit button is, that'd be great...thank you~
EDIT: Hmm...edit button on this post but not the first. Odd. |
| All times are GMT -5. The time now is 4:30 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC