ProcedureDLL to work in exe files

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

ProcedureDLL to work in exe files

Post 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.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

+1

Have often thought this would be nice. In fact I would use it right now if it was possible!
I may look like a mule, but I'm not a complete ass.
milan1612
Addict
Addict
Posts: 894
Joined: Thu Apr 05, 2007 12:15 am
Location: Nuremberg, Germany
Contact:

Post 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? :?:
Windows 7 & PureBasic 4.4
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Google gtk_builder_connect_signals().
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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.
I may look like a mule, but I'm not a complete ass.
MrMat
Enthusiast
Enthusiast
Posts: 762
Joined: Sun Sep 05, 2004 6:27 am
Location: England

Post by MrMat »

This has been requested before and used to be easy until 4.02 came out. Still gets my vote though :)
Mat
milan1612
Addict
Addict
Posts: 894
Joined: Thu Apr 05, 2007 12:15 am
Location: Nuremberg, Germany
Contact:

Post 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?
Windows 7 & PureBasic 4.4
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Exactly.

The API function LoadLibrary_() can load an exe into the calling process as well as a dll.
I may look like a mule, but I'm not a complete ass.
localmotion34
Enthusiast
Enthusiast
Posts: 665
Joined: Fri Sep 12, 2003 10:40 pm
Location: Tallahassee, Florida

Post 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.

Code: Select all

!.WHILE status != dwPassedOut
! Invoke AllocateDrink, dwBeerAmount
!MOV Mug, Beer
!Invoke Drink, Mug, dwBeerAmount
!.endw
User avatar
mback2k
Enthusiast
Enthusiast
Posts: 257
Joined: Sun Dec 02, 2007 12:11 pm
Location: Germany

Post 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. :)
cxAlex
User
User
Posts: 88
Joined: Fri Oct 24, 2008 11:29 pm
Location: Austria
Contact:

Post by cxAlex »

It's possible!

Specify a linker option file with this content:

Code: Select all

/ALLOWBIND
Greets, Alex
Post Reply