Click to See Complete Forum and Search --> : VC++ DLL's
crptcblade
Feb 17th, 2001, 04:46 PM
I forget If I asked this before or not, but I'm having trouble writing a C++ DLL for use in VB...The VB error I'm getting is something like "Cannot find point of entry for DLL" or something like that, it's been a few days since I last tried it...Any help woulld be appreciated...
use this style function declaration:
int _stdcall add(int one, int two)
{
return one + two;
}
crptcblade
Feb 17th, 2001, 07:15 PM
thanks Dennis, I don't need a DEF file or something like that, or do I??
crptcblade
Feb 17th, 2001, 07:31 PM
here is the code that VC++ generated, the code I wrote is in bold:
#include "stdafx.h"
float _GetMiddle(float pointA, float pointB);
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
float _GetMiddle(float pointA, float pointB)
{
float result;
result = (pointA + pointB)/2;
return result;
}
the error I get in VB is : "Can't find entry point GetMiddle in test". test is the name I gave the DLL. I haven't used C++ in a while, and this is the first DLL I'm writing, so try to dumb down your reponse if you like to use techno-babble...
Sorry, yes you do need a DEF file.
LIBRARY "test.dll"
EXPORTS
add
crptcblade
Feb 17th, 2001, 07:53 PM
Sorry for the ignorance, but How do I tie that in with the project, do you know?
Click on the 'source files' folder, and go to the file menu, and click 'new', then chose 'text file', name the file 'test.def'
the name doesn't matter much, but just make sure it has a *.def ending.
crptcblade
Feb 17th, 2001, 08:00 PM
cool, thanks...
parksie
Feb 21st, 2001, 02:14 PM
VC++ automatically sends it to the linker if there's one in the project. If you ever need the command line for it, there's docs on MSDN as to how to do it.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.