Re: using exe as dll
From: Arkady Frenkel (arkadyf_at_hotmailxdotx.com)
Date: 08/04/04
- Next message: Arkady Frenkel: "Re: Packet to process ID mapping in filter-hook driver."
- Previous message: Arkady Frenkel: "Re: Mini Firewall."
- In reply to: Tim Roberts: "Re: using exe as dll"
- Next in thread: Gary Chanson: "Re: using exe as dll"
- Reply: Gary Chanson: "Re: using exe as dll"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 4 Aug 2004 10:46:13 +0300
Really dllmain is not obligatory because if you have dll without it windows
will supply it's own one instead , so if you don't need any init/deinit ,
you don't need it at all.
OTOH you can LoadLibrary of your exe , GetProcAddress of export function in
it and go...
Arkady
"Tim Roberts" <timr@probo.com> wrote in message
news:v3o0h01uptrlnlik536fk6diq5roqlhj2s@4ax.com...
> dbabits@hotmail.com (dima) wrote:
> >
> >It is possible to export functions out of exe and then use it as
> >dll.What are the potential problems? I am aware of possible C-runtime
> >initialization issues, and also of course there's no DllMain etc.
>
> Actually, your last phrase pinpoints the root of the problem. DllMain is
> not magic, it's just the standard name used for the initial entry point of
> a DLL. For an EXE, the initial entry point goes instead to main or
> WinMain.
>
> When a PE file is loaded, the operating system always calls the initial
> entry point. Thus, although you CAN load an executable as a DLL, as soon
> as you do so, the executable's main() entry point will be called and the
> program will run.
>
> >But still, any comments appreciated. BTW, the goal is to have 1 file
> >that could be used as an executable or as a library and not have to
> >compile 2 binaries.
>
> I think you'll need to make a DLL with a very small main program to call
> it.
> --
> - Tim Roberts, timr@probo.com
> Providenza & Boekelheide, Inc
- Next message: Arkady Frenkel: "Re: Packet to process ID mapping in filter-hook driver."
- Previous message: Arkady Frenkel: "Re: Mini Firewall."
- In reply to: Tim Roberts: "Re: using exe as dll"
- Next in thread: Gary Chanson: "Re: using exe as dll"
- Reply: Gary Chanson: "Re: using exe as dll"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|