Board index » cppbuilder » DLL Entry point missing

DLL Entry point missing


2004-01-24 03:35:24 AM
cppbuilder70
I'am a newbe,
Tried to make a Hello World DLL
Build worked ok,
Register DLL failed.
Module entry point missing
DllRegisterCommand
Code is like:
#include "cstring.h"
#include "windows.h"
static HINSTANCE this_hInst;
static string StringReturn;
extern "C" const char * _export SayHello(){
StringReturn = "Hello";
return StringReturn.c_str();
}
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
{
MessageBox(0,"OK?", "It Works",0);
return 1;
}
Bob
 
 

Re:DLL Entry point missing

In Win32 code __declspec(dllexport) is used instead of _export
and __declspec(dllimport) instead of _import.
this_hInst is not used so should generate a warning.
The calling parameters to DllEntryPoint are not used so should
generate warnings
I have not heard of DllRegisterCommand. If you are talking about
registering a DLL with Windows that is done for ActiveX controls
but this is not such a control.
Try this version of the code:
--------------------------------
#include "cstring.h"
#include "windows.h"
static string StringReturn;
extern "C"
__declspec(dllexport) const char *SayHello()
{
StringReturn = "Hello";
return StringReturn.c_str();
}
int WINAPI DllEntryPoint(HINSTANCE, unsigned long reason, void*)
{
if ((reason != DLL_PROCESS_DETACH) &&
(reason != DLL_THREAD_DETACH))
MessageBox(0,"OK?", "It Works",0);
return 1;
}
--------------------------------
You of course would need a program to call the DLL. This should do it:
--------------------------------
#include <windows.h>
extern "C"
__declspec(dllimport) const char *SayHello();
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
SayHello();
return 0;
}
--------------------------------
After you build your DLL then run implib on it to create an import library
and add that library to the project for the calling program. If both the
DLL and EXE projects were set for debug info on then you should be able to
step through the code of the calling program and of the DLL.
. Ed
Quote
Bob van der Putten en Janetta Top wrote in message
news:4011777c$ XXXX@XXXXX.COM ...

I'am a newbe,
Tried to make a Hello World DLL
Build worked ok,
Register DLL failed.
Module entry point missing
DllRegisterCommand
Code is like:
#include "cstring.h"
#include "windows.h"


static HINSTANCE this_hInst;
static string StringReturn;

extern "C" const char * _export SayHello(){
StringReturn = "Hello";
return StringReturn.c_str();
}


int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
{
MessageBox(0,"OK?", "It Works",0);
return 1;
}
 

Re:DLL Entry point missing

Thanks for your reply, however it did not solve my problem
I want to regegister de DLL to be used in a ASP file by CreateObject(...).
So I wrote my DLL, and called Register OLE Server command (right mouse
click on project file, and Special->Register OLE Server).
Now I still get the error. The window that apeared is attached as a
image (failed...)
It says:
-------------------------------------
| Module entry point missing X |
-------------------------------------
| DllRegisterCommand |
| |
| OK |
-------------------------------------
(Or don't I simply know what I'am doing....)
Bob
Ed Mulroy [TeamB] wrote:
Quote
In Win32 code __declspec(dllexport) is used instead of _export
and __declspec(dllimport) instead of _import.

this_hInst is not used so should generate a warning.

The calling parameters to DllEntryPoint are not used so should
generate warnings

I have not heard of DllRegisterCommand. If you are talking about
registering a DLL with Windows that is done for ActiveX controls
but this is not such a control.

Try this version of the code:

--------------------------------
#include "cstring.h"
#include "windows.h"

static string StringReturn;

extern "C"
__declspec(dllexport) const char *SayHello()
{
StringReturn = "Hello";
return StringReturn.c_str();
}


int WINAPI DllEntryPoint(HINSTANCE, unsigned long reason, void*)
{
if ((reason != DLL_PROCESS_DETACH) &&
(reason != DLL_THREAD_DETACH))
MessageBox(0,"OK?", "It Works",0);

return 1;
}
--------------------------------

You of course would need a program to call the DLL. This should do it:

--------------------------------
#include <windows.h>

extern "C"
__declspec(dllimport) const char *SayHello();

int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
SayHello();
return 0;
}

--------------------------------

After you build your DLL then run implib on it to create an import library
and add that library to the project for the calling program. If both the
DLL and EXE projects were set for debug info on then you should be able to
step through the code of the calling program and of the DLL.

. Ed



>Bob van der Putten en Janetta Top wrote in message
>news:4011777c$ XXXX@XXXXX.COM ...
>
>I'am a newbe,
>Tried to make a Hello World DLL
>Build worked ok,
>Register DLL failed.
>Module entry point missing
>DllRegisterCommand
>Code is like:
>#include "cstring.h"
>#include "windows.h"
>
>
>static HINSTANCE this_hInst;
>static string StringReturn;
>
>extern "C" const char * _export SayHello(){
>StringReturn = "Hello";
>return StringReturn.c_str();
>}
>
>
>int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
>{
>MessageBox(0,"OK?", "It Works",0);
>return 1;
>}
>
>




 

{smallsort}

Re:DLL Entry point missing

First: I do not see very often such an excellent description as from Ed
Mulroy.
Second: I am afraid that this is not the place to teach building COM
objects like OLE/ActiveX server which are not simply DLLs.
Third: depending on your version of BC you can have a look on the examples,
you could search for directories using the filter *ole*;*ocf*;*com*. The
other way is building COM objects by hand and by searching the web or
reading a book. (Once you have done it you will find it easy.)
Gru? gw
Bob van der Putten en Janetta Top wrote:
Quote
Thanks for your reply, however it did not solve my problem
I want to regegister de DLL to be used in a ASP file by CreateObject(...).
So I wrote my DLL, and called Register OLE Server command (right mouse
click on project file, and Special->Register OLE Server).
Now I still get the error. The window that apeared is attached as a
image (failed...)
It says:
-------------------------------------
| Module entry point missing X |
-------------------------------------
| DllRegisterCommand |
| |
| OK |
-------------------------------------

(Or don't I simply know what I'am doing....)

Bob

Ed Mulroy [TeamB] wrote:

>In Win32 code __declspec(dllexport) is used instead of _export
>and __declspec(dllimport) instead of _import.
>
>this_hInst is not used so should generate a warning.
>
>The calling parameters to DllEntryPoint are not used so should
>generate warnings
>
>I have not heard of DllRegisterCommand. If you are talking about
>registering a DLL with Windows that is done for ActiveX controls
>but this is not such a control.
>
>Try this version of the code:
>
>--------------------------------
>#include "cstring.h"
>#include "windows.h"
>
>static string StringReturn;
>
>extern "C"
>__declspec(dllexport) const char *SayHello()
>{
>StringReturn = "Hello";
>return StringReturn.c_str();
>}
>
>
>int WINAPI DllEntryPoint(HINSTANCE, unsigned long reason, void*)
>{
>if ((reason != DLL_PROCESS_DETACH) &&
>(reason != DLL_THREAD_DETACH))
>MessageBox(0,"OK?", "It Works",0);
>
>return 1;
>}
>--------------------------------
>
>You of course would need a program to call the DLL. This should do it:
>
>--------------------------------
>#include <windows.h>
>
>extern "C"
>__declspec(dllimport) const char *SayHello();
>
>int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
>{
>SayHello();
>return 0;
>}
>
>--------------------------------
>
>After you build your DLL then run implib on it to create an import library
>and add that library to the project for the calling program. If both the
>DLL and EXE projects were set for debug info on then you should be able to
>step through the code of the calling program and of the DLL.
>
>. Ed
>
>
>
>>Bob van der Putten en Janetta Top wrote in message
>>news:4011777c$ XXXX@XXXXX.COM ...
>>
>>I'am a newbe,
>>Tried to make a Hello World DLL
>>Build worked ok,
>>Register DLL failed.
>>Module entry point missing
>>DllRegisterCommand
>>Code is like:
>>#include "cstring.h"
>>#include "windows.h"
>>
>>
>>static HINSTANCE this_hInst;
>>static string StringReturn;
>>
>>extern "C" const char * _export SayHello(){
>>StringReturn = "Hello";
>>return StringReturn.c_str();
>>}
>>
>>
>>int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
>>{
>>MessageBox(0,"OK?", "It Works",0);
>>return 1;
>>}
>>
>>
>
>
>
>
 

Re:DLL Entry point missing

Quote
The window that apeared is attached as a image (failed...)
As you can see in the newsgroup guidelines, attachments are banned here:
info.borland.com/newsgroups/guide.html
If you must post an attachment, there is a group for that:
borland.public.attachments
My reply was because I did not see in what you showed anything which
appeared to be related to something of a type or style which would require
registration and no classes let alone OWL items.
It has been years since I did any OLE stuff with BC++ (the last BC++
version, 5.02, is from 7 years ago). I remember needing to automate one or
more classes in ClassExpert and that would also cause TApplication to be
exposed. While your DllEntryPoint looks correct I remember OwlMain as the
entry point although that is the name used in a OWL EXE so is probably
wrong.
If none of this is helpful then it would probably be best for you to post a
new message with your question as others will see that I've replied and
think the question had been handled.
. Ed
Quote
Bob van der Putten en Janetta Top wrote in message
news:401296e3$ XXXX@XXXXX.COM ...

Thanks for your reply, however it did not solve my problem
I want to regegister de DLL to be used in a ASP file by
CreateObject(...). So I wrote my DLL, and called Register
OLE Server command (right mouse click on project file,
and Special->Register OLE Server). Now I still get the
error. The window that apeared is attached as a image (failed...)

It says:
-------------------------------------
| Module entry point missing X |
-------------------------------------
| DllRegisterCommand |
| |
| OK |
-------------------------------------

(Or don't I simply know what I'am doing....)