Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 18th, 2005, 5:37 PM   #1
Floppie
Newbie
 
Join Date: Feb 2005
Posts: 18
Rep Power: 0 Floppie is on a distinguished road
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 Integer


My 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.
Floppie is offline   Reply With Quote
Old Feb 20th, 2005, 1:08 PM   #2
Floppie
Newbie
 
Join Date: Feb 2005
Posts: 18
Rep Power: 0 Floppie is on a distinguished road
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.
Floppie is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:44 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC