External methods: XPlatform Apps?

  1. 8 weeks ago

    Karen A

    Apr 1 Testers

    I am probably just lacking a basic understanding here...

    I have never used external methods, just declares that could be put in #If Target* blocks

    Looking at the docs for external methods, I don't see a way of specifying which desktop Ones they should be included for...

    IIRC the complier only strips code for unused modules and classes, and not more granularly.

    For an Xplatform app :

    Does it not matter (compiler somehow knows it's not for the platform the app is being complied for, or a declare is auto inserted when needed in line?)

    If not Is there a way to specify which OS they are for?

    Do you just specify all external methods as soft so it does not matter unless called?

    Or do they need to be put into separate modules by OS with only stuff specificities to that OS so the compiler does not include the unused modules for that platform?

    In any case it might be a good idea to clarify this point in the docs.

    Thanks,
    -Karen

  2. Norman P

    Apr 1 Testers, Xojo Pro outside LMAO !!!!!!!
    Edited 8 weeks ago

    @Karen A I am probably just lacking a basic understanding here...

    I have never used external methods, just declares that could be put in #If Target* blocks

    Looking at the docs for external methods, I don't see a way of specifying which desktop Ones they should be included for...

    you dont
    stick to methods that wrap declares in #if Target blocks :)

    at best you put all the macOS ones in one module and the ones for Windows in another
    but you have no way to say which module goes in what target :(
    Feedback Case #56852

    you'd have to manually change the compat flags on the modules when you build so one IS compatible with desktop (or whatever you're building) and the other isnt

    and then you code still has to have the right #if targets somewhere since the external methods arent going to be correct on macOS if they are set up for Windows :)

    external methods are lazy ways to deal with declares that arent quite as flexible because of these issues

  3. Karen A

    Apr 1 Testers

    @Norman P you dont
    stick to methods that wrap declares in #if Target blocks :)

    Thanks...

    Seems strange that one can not specify the target for an External Method in a products who's biggest feature is being X-Platform!

    -Karen

  4. Karen A

    Apr 1 Testers
    Edited 8 weeks ago

    @Norman P at best you put all the macOS ones in one module and the ones for Windows in another
    but you have no way to say which module goes in what target :(

    But should not that should take care of itself as long as all the calls to them are in #Target blocks?

    That way the whole module should get stripped, so there would be no need to specify module platform.. One just has to make sure the code/properties/enums etc are strictly limited to being use by one platform.

    Is that right?

    Including the platform name in teh Module name would make which platform it was for obvious.

    -karen

  5. Norman P

    Apr 1 Testers, Xojo Pro outside LMAO !!!!!!!

    @Karen A Thanks...

    Seems strange that one can not specify the target for an External Method in a products who's biggest feature is being X-Platform!

    -Karen

    no
    exposed
    compat
    flags

    which would let you do exactly that

  6. Norman P

    Apr 1 Testers, Xojo Pro outside LMAO !!!!!!!

    @Karen A But should not that should take care of itself as long a step calls are in #Target blocks?

    That way the whole module should get stripped, so there would be no need to specify module platform.. One just has to make sure the code/properties/enums etc as string limited to being use by one platform.

    Is that right?

    Including the platform name in teh Module name would make which platform it was for obvious.

    -karen

    right but if you have to put every call to an external in #if why not wrap it once in a method and do that once inside the method ?
    I agree that it MIGHT not be possible to always come up with a method that meets all need or an API that works x-plat

    but doing this one rather than at every call site seems less error prone to me

or Sign Up to reply!