Author Topic: Digital Mars DllMain not executed  (Read 5213 times)

Offline jimp

  • Multiple posting newcomer
  • *
  • Posts: 15
Digital Mars DllMain not executed
« on: December 22, 2005, 06:58:16 pm »
I have a problem when compiling a DLL with the Digital Mars compiler.

The program compiles with no warnings or errors.  It is compiled with the options:
dmc.exe -mn -c   -x -WD -w-

and linked with the options:
link.exe /NOLOGO /DELEXECUTABLE /EXETYPE:NT /SUBSYSTEM:WINDOWS

The calling program uses explicit linking with LoadLibrary and GetProcAddress.  Both of these functions execute without getting an error.  But the DllMain function is never called.  I put a messagebox in the DllMain function to verify this.

I tried this with the Borland and GNU GCC compilers.  It worked OK with both.  It must be something about the Digital Mars compiler.  An option?  Something I am omitting?  Or is it just not executed with explicit linking? 

Why isn't the DllMain function being called????
Any suggestions would be appreciated.

takeshimiya

  • Guest
Re: Digital Mars DllMain not executed
« Reply #1 on: December 22, 2005, 07:21:33 pm »

Offline jimp

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Digital Mars DllMain not executed
« Reply #2 on: December 22, 2005, 09:53:44 pm »
I don't believe it but the above link actually allowed me to fix the problem.

It needed an input .def file.  I copied the sample file given changing only the program name.  Then I changed the command line to include the .def file.  All the problems I had disappeared.

Some of the commands in the .def file can be included as options on the command line (EXETYPE NT, SUBSYSTEM WINDOWS) and some cannot (CODE SHARED EXECUTE, DATA WRITE).  My guess is that CODE SHARED EXECUTE is what was needed to create a dll.

Thanks for the info.  I probably never would have figured it out.

JimP

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Digital Mars DllMain not executed
« Reply #3 on: December 22, 2005, 10:11:32 pm »
Hello,

Have you tried to search in the forum if some of the posts could help you to solve your problems (you can use the advanced search for more powerful queries).

May be you can also try to post in the Digital Mars forum and see what they can tell you.

Best wishes,
Michael

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Digital Mars DllMain not executed
« Reply #4 on: December 22, 2005, 10:59:43 pm »
Could this post be of some help?

Michael