Re: using exe as dll
From: Tim Roberts (timr_at_probo.com)
Date: 08/04/04
- Next message: Relvinian: "Re: ReadDirectoryChangesW"
- Previous message: Owais Khan: "Re: Undocumented Element in OVERLAPPED structure"
- In reply to: dima: "using exe as dll"
- Next in thread: Arkady Frenkel: "Re: using exe as dll"
- Reply: Arkady Frenkel: "Re: using exe as dll"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 03 Aug 2004 21:10:27 -0700
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: Relvinian: "Re: ReadDirectoryChangesW"
- Previous message: Owais Khan: "Re: Undocumented Element in OVERLAPPED structure"
- In reply to: dima: "using exe as dll"
- Next in thread: Arkady Frenkel: "Re: using exe as dll"
- Reply: Arkady Frenkel: "Re: using exe as dll"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|