Page 1 of 1

ProcedureDLL to work in exe files

Posted: Mon Jun 01, 2009 1:13 pm
by Trond
ProcedureDLL makes the procedure exported from the compiled file, but only if you compile a dll file. It would be nice if it worked with exe files as well.

Posted: Mon Jun 01, 2009 1:51 pm
by srod
+1

Have often thought this would be nice. In fact I would use it right now if it was possible!

Posted: Mon Jun 01, 2009 1:52 pm
by milan1612
Why would one want to export a function in an executable? I don't see an actual use
of this, what am I overlooking? :?:

Posted: Mon Jun 01, 2009 3:09 pm
by Trond
Google gtk_builder_connect_signals().

Posted: Mon Jun 01, 2009 3:26 pm
by srod
milan1612 wrote:Why would one want to export a function in an executable? I don't see an actual use
of this, what am I overlooking? :?:
I wish one of the programs I am currrently working on to run both as a separate executable or to be loaded as a dll and run 'in process'. This requires either a separate dll version of the program or the ability of the exe to export a function or two.

I know which option I would prefer! :wink:

I always found this a somewhat strange omission from PB given that most linkers can export functions from an exe.

Posted: Mon Jun 01, 2009 3:37 pm
by MrMat
This has been requested before and used to be easy until 4.02 came out. Still gets my vote though :)

Posted: Mon Jun 01, 2009 5:17 pm
by milan1612
srod wrote:
milan1612 wrote:Why would one want to export a function in an executable? I don't see an actual use
of this, what am I overlooking? :?:
I wish one of the programs I am currrently working on to run both as a separate executable or to be loaded as a dll and run 'in process'. This requires either a separate dll version of the program or the ability of the exe to export a function or two.

I know which option I would prefer! :wink:

I always found this a somewhat strange omission from PB given that most linkers can export functions from an exe.
Okay, I see. How'd you access such an exported function? With the regular Library functions?

Posted: Mon Jun 01, 2009 5:24 pm
by srod
Exactly.

The API function LoadLibrary_() can load an exe into the calling process as well as a dll.

Posted: Mon Jun 01, 2009 6:10 pm
by localmotion34
Yes, you can load exe files as a DLL. If you have ever diassembled an EXE before, you can see that there are export functions associated with it.

Delphi apps can do this, as well as other compilers too.

Posted: Sun Jun 14, 2009 9:35 am
by mback2k
It would also be great to have a compiler switch which makes all functions compile as exported. This would would make runtime ASM based debugging easier, because you would have named function (symbols) instead. :)

Posted: Sun Jul 26, 2009 2:40 pm
by cxAlex
It's possible!

Specify a linker option file with this content:

Code: Select all

/ALLOWBIND
Greets, Alex