Board index » cppbuilder » DLL problem: Can't find entry point

DLL problem: Can't find entry point


2006-06-26 06:37:02 PM
cppbuilder83
Hello,
I'm trying to upgrade a DLL to BDS, and I can't get our DLL exported
functions to
work. To rule out any code upgrade problems, I've created an
entirely new DLL of the "C++" type called "test.dll", and written the
following code in a new unit:
(.h)
short JustATest(short& parameter);
(.cpp)
short _export JustATest(short& parameter)
{
parameter = 50;
return 0;
}
Calling this function from Visual Basic code gives a runtime error: "Can't
find entry point for JustATest in test.dll".
I suspect - Am I missing something very, very basic?
The problem is in the DLL since the same function created in the BCB6
project works.
TIA,
Daniel
 
 

Re:DLL problem: Can't find entry point

Daniel Daranas wrote:
Quote

I suspect - Am I missing something very, very basic?

The problem is in the DLL since the same function created in the BCB6
project works.

TIA,

Daniel

I think you're missing DllMain entry function in your .dll project.
Muzaffar
 

Re:DLL problem: Can't find entry point

Daniel Daranas wrote:
Quote
Hello,

I'm trying to upgrade a DLL to BDS, and I can't get our DLL exported
functions to work. To rule out any code upgrade problems, I've
created an entirely new DLL of the "C++" type called "test.dll", and
written the following code in a new unit:

(.h)
short JustATest(short& parameter);

(.cpp)
short _export JustATest(short& parameter)
{
parameter = 50;
return 0;
}

Calling this function from Visual Basic code gives a runtime error:
"Can't find entry point for JustATest in test.dll".

When fixing such problems it helps a lot to have depends.exe, download
from microsoft. This program show what functions exist in your dll
(tdump.exe from borland could also be used).
I guess you have a name mangling problem, your declaration should be
like extern "C" short JustATest(...
hth
--
frode
 

{smallsort}

Re:DLL problem: Can't find entry point

Daniel Daranas wrote:
Quote
Calling this function from Visual Basic code gives a runtime error: "Can't
find entry point for JustATest in test.dll".

I suspect - Am I missing something very, very basic?

(.h)
short JustATest(short& parameter);
This should be:
extern "C" __declspec(dllexport) short __stdcall JustATest(short&
parameter);
and:
Quote
short _export JustATest(short& parameter)
extern "C" __declspec(dllexport) short __stdcall JustAText(short& parameter)
Quote
{
parameter = 50;
return 0;
}
Then you'll be able to import this function as _JustATest into your VB
project.
HTH
Jonathan
-----------------------------------------------------------------
TwineCompiler - Blazingly fast C++ compiles on ANY machine.
www.jomitech.com/
-----------------------------------------------------------------
 

Re:DLL problem: Can't find entry point

"Daniel Daranas" wrote:
Quote
I'm trying to upgrade a DLL to BDS
Thanks all your kind suggestions. We've managed to make the exported
function work (with extern "C" and the standard modifiers suggested by
Jonathan) and now we're struggling to make our project work.
Daniel
 

Re:DLL problem: Can't find entry point

Daniel Daranas wrote:
Quote
Thanks all your kind suggestions. We've managed to make the exported
function work (with extern "C" and the standard modifiers suggested by
Jonathan) and now we're struggling to make our project work.
Take a look at
web.archive.org/web/20041009193204/www.bcbdev.com/articles/vcdll.htm
(Using Visual C++ DLLs in a C++Builder Project)
and other articles about DLL on this site.
Alex.
 

Re:DLL problem: Can't find entry point

"AlexB" < XXXX@XXXXX.COM >wrote:
Quote
Take a look at
web.archive.org/web/20041009193204/www.bcbdev.com/articles/vcdll.htm
(Using Visual C++ DLLs in a C++Builder Project)
and other articles about DLL on this site.
Thanks Alec, useful article.
After changing to take into account what seem to be different names for
locales, I think we're close to our goal.
Daniel