Experts please: defining DllMain in static library

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Is it possible to define DllMain in a static library for use in dlls? The
reason is that I am defining a platform abstraction for being loaded as a
shared library and I figured the simplest way is to implement DllMain in a
static library, which then calls mydllmain.

I define this library (call it platform.lib) which has DllMain implemented
with what should be unresolved references to mydllmain. I then link it into a
bunch of dll's. Unfortunately, this doesn't work as the linker doesn't
include platform.lib's version of DllMain.

I have explored all the linker flags, but I am lost on this one. I have also
added DllMan to the EXPORTS section of the .def file in the hope that may
force the linker to look in my static library for the symbol.

Can someone please help? I don't see any clean way to do this without
passing around some object filenames (which is why archive libraries were
invented!)

Thanks!
 
Sean Connery said:
Hi,

Is it possible to define DllMain in a static library for use in dlls? The
reason is that I am defining a platform abstraction for being loaded as a
shared library and I figured the simplest way is to implement DllMain in a
static library, which then calls mydllmain.

Argh! /include:_DllMain@12
 
Back
Top