Xojo "Require" or "Include"

If I have some external Xojo code I’d like to “include” into a Xojo Project, is the proper way to use the “Import External” function?

  1. what sort of “external code” ? it has to be Xojo code
  2. you can leave it external and then you can “include” that item in many projects but only have one true source for it

Yes, Xojo code. I’d like to package up my debugging code and objects and pull them into a separate module and then I can maybe include them when debugging and keep them out when building. I guess there’s a script command I could use to import and remove a module?

So when I update the external code, it will be changed in the project that “includes it”?

In your debug code if you wrap calls to that code in #if debugbuild then the call will be removed
Then if the methods called start with #if debugbuild and end with #endif then ALL the code in that method will not exist in a debug build

Adding & removing code all the time is not needed
In fact thats likely to give you fits eventually

And yes IF the external is updated then when you reopen the project the code will update (it should update when changed but I dont rely on that)

I understand that. But I’d like to see if I can remove the modules, classes and everything.

I’d like to wrap #if DebugBuild around the “include” method if there is one…

There isnt

But if a method contains

Sub foo()
#if debugbuild 
  // lots of code here
#endif
end sub

THE ONLY thing remaining in a build is the declaration - no code inside

And, in some cases, if the callers are also surrounded by #if debugbuild then, because the method is NEVER used in a BUILT app even the declaration will be stripped

IF you put all this debug code in a module & its methods are ONLY called in debugbuilds that entire module will automagically be stripped because it is NEVER used

You manually stripping it out is 100% unnecessary (it is in most languages but …)

1 Like

I use Arbed to create a copy of the project and import the externals at the same time, to which I compress and store in a folder.

https://www.tempel.org/Arbed/Arbed

1 Like