Just starting out? Need help? Post your questions and find answers here.
chi
Addict
Posts: 1028 Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria
Post
by chi » Sun Mar 05, 2017 7:40 pm
It was already addressed
here , but not as a bug... So here is the official bug report
Code: Select all
D:\Program Files\PureBasic5.60(x86)\Compilers>pbcompiler.exe /REASM /DLL PureBasic.asm
******************************************
PureBasic 5.60 (Windows - x86)
******************************************
Compiling PureBasic.asm
Loading external libraries...
ReAssembling source code...
Creating DLL "PureBasic.dll"
Error: Linker
POLINK: fatal error: Unable to read module-definition file 'PureBasic.def'.
Last edited by
chi on Sun Apr 23, 2017 2:40 pm, edited 1 time in total.
Et cetera is my worst enemy
chi
Addict
Posts: 1028 Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria
Post
by chi » Fri Apr 21, 2017 8:32 pm
OK, I figured it out... Let me know if you're even interested, because it's a little bit cumbersome and creating a walkthrough would take some time.
In addition I also learned how to link with polink v8
Et cetera is my worst enemy
skywalk
Addict
Posts: 3972 Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA
Post
by skywalk » Fri Apr 21, 2017 11:25 pm
Whoa, that is great. I tried a while back and failed with different settings and gave up.
I was attempting to automate dead code removal with the flattened asm, but the output format changed. I cannot find my stale procedure calls to delete prior to reasm.
But, it would be good to know how to automate builds with reasm and any compiler setting?
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
chi
Addict
Posts: 1028 Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria
Post
by chi » Sat Apr 22, 2017 3:54 am
...it's a little bit cumbersome and creating a walkthrough would take some time
Turns out everything works so much better when A) operating from the PB compiler directory and B) not having a different version of polink installed
.
In a nutshell:
Put your .pb file into
#PB_Compiler_Home + "Compilers\" and open a
command prompt :
1) First you need the
PureBasic.asm and
PureBasic.def file:
Code: Select all
pbcompiler.exe /COMMENTED /DLL "my_dll.pb"
2) You can
REASM now:
Code: Select all
pbcompiler.exe /REASM /DLL "PureBasic.asm"
3) If you want to follow the calling convention and decorate your library accordingly (e.g. x86 stdcall), you need to edit
PureBasic.def :
(Optional)
Code: Select all
LIBRARY "PureBasic.dll"
EXPORTS
"MsgBox"="Procedure8"
...
to
Code: Select all
LIBRARY "PureBasic.dll"
EXPORTS
"_MsgBox@8"="Procedure8"
...
4) Update
PureBasic.lib to include your exports:
Code: Select all
polib.exe /VERBOSE /DEF:"PureBasic.def" /OUT:"PureBasic.lib"
That's all folks
cheers, chi
Et cetera is my worst enemy