Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

HaywireGuy

Export functions within EXE

This topic is 5481 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hmm... Originally I made a Win32 EXE with WinMain(...) in it. Then I thought I can export some functions so that I can load the EXE as a DLL from another application. But as I add in the DEF file to export those functions, it gave an error: warning LNK4086: entrypoint "_WinMainCRTStartup" is not __stdcall with 12 bytes of arguments; image may not run And then my EXE cannot execute anymore What seems to be the way of exportin'' functions from within my EXE? Thanks in advanced!!

Share this post


Link to post
Share on other sites
Advertisement
quote:
Original post by Krylloan
Why do you want to do this?


Indeed...why? The purpouse of DLLs are to modularize things to allow multiple programs to use the same binary code... which happens to be easily replacable seperate of programs dependant on it for, say, a bugfix, or optimization inclusion. Why deny this to the program that would be directly connected to it?

Share this post


Link to post
Share on other sites
Woo that was fast

OK because I'm developin' this EXE as a stand alone. And the
requirement is that another application will be runnin' my EXE
through CreateProcess(). This "another application" is suppose
to call my EXE (yes, it's cross process) usin' SendMessage()
once in a while.

Now before another engineer develops the "another application",
I can execute my EXE and pass info to it usin' my own "test
application". So the EXE will export a function as an entry
point that my "test applicatoin" can call and run it. (Hmmm...
I don't want CreateProcess(), just wonderin' if that is even
possible)

Thanks so much guys!







[edited by - HaywireGuy on August 18, 2003 1:48:28 AM]

Share this post


Link to post
Share on other sites
You might want to break your program into two parts.

One, with the main() function, which basically interprets whatever parameters it is passed on execution and loads/calls the DLL, and the main routine, which is the DLL.

This will allow you to have a standalone version and a plugin version.

Share this post


Link to post
Share on other sites
Thanks man!

I got to export the function usin' a DEF file already. But then
once it gets into the exported function, ExportFunc(), it fails.


DWORD ExportFunc(LPVOID lpvContext)
{
// The function fails here...

CMyClass cls;
return 0;
}


It generates an access violation straight when comes to the
CMyClass constructor... which does nothin' at all. Nevermind, I
guess EXE cum DLL is somethin' impossible







[edited by - HaywireGuy on August 18, 2003 5:16:08 AM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!