Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unused routines still result in huge .EXE
#4
I was under the impression that code included in libraries but not used would be ignored by the compiler. I remember a discussion about this, either on this forum or perhaps a previous one. Since the introduction of $INCLUDONCE I have broke down most of my large libraries into smaller individual routines to be included as needed. I did this because it makes code much easier to reuse but am glad to hear this also helps with ignoring unused code.

Here is an example of the libraries I have included in a project I'm currently working on. This approach makes much more sense to me.

Code: (Select All)
'$INCLUDE:'.\lib\common\lib_type_rect.bi'           TYPE_RECT
'$INCLUDE:'.\lib\common\lib_type_circle.bi'         TYPE_CIRCLE
'$INCLUDE:'.\lib\common\lib_type_line.bi'           TYPE_LINE
'$INCLUDE:'.\lib\common\lib_type_spoint.bi'         TYPE_SPOINT (SINGLE  x,y)
'$INCLUDE:'.\lib\collision\lib_circcollide.bi'      CircCollide% function
'$INCLUDE:'.\lib\collision\lib_linecollide.bi'      LineCollide% function
'$INCLUDE:'.\lib\collision\lib_pixelcollide.bi'     PixelCollide% function
'$INCLUDE:'.\lib\collision\lib_rectcollide.bi'      RectCollide% function
'$INCLUDE:'.\lib\collision\lib_circrectcollide.bi'  CircRectCollide% function
'$INCLUDE:'.\lib\image\lib_img_flip.bi' '           IMG_Flip subroutine
'$INCLUDE:'.\lib\image\lib_img_introtate.bi'        IMG_INTRotate subroutine (integer degrees calculated faster)
'$INCLUDE:'.\lib\fps\lib_fps.bi'                    FPS library (FPS_)
'$INCLUDE:'.\lib\math\lib_math_vec2deg.bi'          MATH_Vec2Deg function
'$INCLUDE:'.\lib\math\lib_math_deg2vec.bi'          MATH_Deg2Vec function
'$INCLUDE:'.\lib\math\lib_math_degp2p.bi'           MATH_DegP2P function
'$INCLUDE:'.\lib\math\lib_math_distancep2p.bi'      MATH_DistanceP2P function

' MAIN CODE HERE

'$INCLUDE:'.\lib\image\lib_img_flip.bm'             IMG_Flip subroutine
'$INCLUDE:'.\lib\image\lib_img_introtate.bm'        IMG_INTRotate subroutine (integer degrees calculated faster)
'$INCLUDE:'.\lib\image\lib_img_zoom.bm'             IMG_Zoom subroutine
'$INCLUDE:'.\lib\collision\lib_circcollide.bm'      CircCollide% function
'$INCLUDE:'.\lib\collision\lib_linecollide.bm'      LineCollide% function
'$INCLUDE:'.\lib\collision\lib_pixelcollide.bm'     PixelCollide% function
'$INCLUDE:'.\lib\collision\lib_rectcollide.bm'      RectCollide% function
'$INCLUDE:'.\lib\collision\lib_circrectcollide.bm'  CircRectCollide% function
'$INCLUDE:'.\lib\fps\lib_fps.bm'                    FPS library (FPS_)
'$INCLUDE:'.\lib\math\lib_math_fixdegree.bm'        MATH_FixDegree function
'$INCLUDE:'.\lib\math\lib_math_vec2deg.bm'          MATH_Vec2Deg function
'$INCLUDE:'.\lib\math\lib_math_deg2vec.bm'          MATH_Deg2Vec function
'$INCLUDE:'.\lib\math\lib_math_degp2p.bm'           MATH_DegP2P function
'$INCLUDE:'.\lib\math\lib_math_distancep2p.bm'      MATH_DistanceP2P function
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply


Messages In This Thread
RE: Unused routines still result in huge .EXE - by TerryRitchie - 07-22-2024, 01:59 PM



Users browsing this thread: 1 Guest(s)