Skip to content

Instantly share code, notes, and snippets.

@chivalry
Created April 7, 2016 02:50
Show Gist options
  • Save chivalry/79753b2ba25e3fc47a91d977e6945b6e to your computer and use it in GitHub Desktop.
Save chivalry/79753b2ba25e3fc47a91d977e6945b6e to your computer and use it in GitHub Desktop.

First of all, I understand that any assistance you provide with this is out of altruism, and if you're able to help me out, I appreciate in advance, but I understand if you're unable to provide any assistance for this freeware product.

I'm using your plugin template to create a plugin that requires 26 external functions, so of course, I had to go beyond your existing 10 that you include the code for. I thought I understood what I needed to do, but the 11th function and beyond don't work correctly. When I install the plugin and launch FileMaker (11, btw), there's space below the plugin name showing where the functions would go, but they're blank until I get to one of the first 10. I'll email a screenshot if that would help.

Here's what I did. In Xcode I edited FMTConfig.h to read like this (with Markdown-inspired formatting for source code):

#define FUNCTION_10_C_NAME         SCIUploadFile2
#define FUNCTION_10_FLAGS          fmx::ExprEnv::kMayEvaluateOnServer \
                                 | fmx::ExprEnv::kDisplayInAllDialogs
#define FUNCTION_10_PARAMS         kAtLeast_2_Parameters, kAtWorst_Unlimited_Parameters
#define FUNCTION_10_PROTOTYPE      "SCIUploadFile2( host ; path [ ; key1=value1 ; key2=value2 ; ... } )"

#define FUNCTION_11_C_NAME         SCIUploadFiles
#define FUNCTION_11_FLAGS          fmx::ExprEnv::kMayEvaluateOnServer \
                             | fmx::ExprEnv::kDisplayInAllDialogs
#define FUNCTION_11_PARAMS         kAtLeast_3_Parameters, kAtWorst_Unlimited_Parameters
#define FUNCTION_11_PROTOTYPE      "SCIUploadFiles( url ; sessionDescription ; directory { ; key1=value1 ; key2=value2 ; ... } )"

Note that function 10 works fine. Function 11 does not.

Then, in FMTemplate.cpp, I edited it as follows:

#ifdef FUNCTION_10_C_NAME
err = RegisterExternalFunction( 10, FUNCTION_10_PARAMS, regFunction10Flags, FUNCTION_10_C_NAME );
if_error(err,bail9);
#endif
#ifdef FUNCTION_11_C_NAME
err = RegisterExternalFunction( 11, FUNCTION_11_PARAMS, regFunction11Flags, FUNCTION_11_C_NAME );
if_error(err,bail10);
#endif

and...

#ifdef FUNCTION_11_C_NAME
 UnRegisterExternalFunction( 11 );
 bail10: 
#endif
#ifdef FUNCTION_10_C_NAME
 UnRegisterExternalFunction( 10 );
 bail9: 
#endif

and...

#ifdef FUNCTION_11_C_NAME
    (void) fmx::ExprEnv::UnRegisterExternalFunction(*pluginID, 11 );
#endif
#ifdef FUNCTION_10_C_NAME
    (void) fmx::ExprEnv::UnRegisterExternalFunction(*pluginID, 10 );
#endif

Finally, FMTemplate.h was edited as follows:

#ifdef FUNCTION_10_C_NAME
extern FMX_PROC(fmx::errcode) FUNCTION_10_C_NAME(short, const fmx::ExprEnv&, const fmx::DataVect&, fmx::Data&);
#endif
#ifdef FUNCTION_11_C_NAME
extern FMX_PROC(fmx::errcode) FUNCTION_11_C_NAME(short, const fmx::ExprEnv&, const fmx::DataVect&, fmx::Data&);
#endif

My obvious question is, what am I doing incorrectly? Are there files besides FMTConfig.h, FMTemplate.h and FMTemplate.cpp that I should be editing to create more than 10 functions?

Please let me know if you're able to help me or if there's additional information I can provide that would be useful.

Thanks, Chuck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment