How external methods can make your code platform specific

In Xojo if you use external methods to simplify writing a declare over & the they can make your code platform specific.

How ?

In a method you can wrap the declare in a #if Target so it wont be used on targets its not intended for.

There is NO way to do this for external methods.

So as soon as you use them your code now has a hard dependency on what ever OS api you just exposed. And there is NO way to easily exclude it from being referred to when compiling for other targets. You simply rely in the code using them being excluded by the compiler since its not referenced (you hope)

IF the code using the external method isnt properly wrapped in a #if Target then you can get errors that are hard to track down since the declare wont be right where the error is saying it is. You just get a warning about a library not found.

I ran into this with code called WinAPILibrary

I‘ve forked this library and REMOVED these so anyone can compile the code regardless of the target but it will only function on Windows

The other issue I’ve run into is sometimes you need the same method defined several times because it can take different parameters. This is a bit easier to do, and IMHO, more obvious with several declares where you need thins than maybe several external methods with varying configurations.

My 2 cents FWIW