![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Feb 2005
Posts: 18
Rep Power: 0
![]() |
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) {
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}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,
const int &filemode = app);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" _
(ByRef strOutString As String, ByRef strFile As String, ByRef filemode As Integer) _
As IntegerMy attempt at actually utilizing the function from VB: outfile_return = outfile("Start Session @" & GetFormattedTime() & Chr$(10), _
"httplog.log", 0)GetFormattedTime() returns a string with the date in it, formatted. If anything else is needed, just say so. |
|
|
|
|
|
#2 |
|
Newbie
Join Date: Feb 2005
Posts: 18
Rep Power: 0
![]() |
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. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|