Older Newer
Thu, 30 Dec 2021 06:47:06 . . . . SyneRyder [Initial function definition]


Changes by last author:

Added:
= callLibFmc =

Requires FM 1.0 Beta 9.0 (April 2008) or newer

== Syntax ==

int callLibFmc(void *fnptr, ...)

== Arguments ==

:fnptr

::A pointer (obtained with getLibFn) to the DLL function to call.

:...

::The other parameters required by the DLL function (varies depending on the function).

== Return ==

Returns the return value of the called DLL function, which varies depending on the function called.

== Description ==

Calls a function in a DLL that has previously been loaded with loadLib and getLibFn, except that the first argument (fnptr) is replaced by a pointer to the FMcontext record (fmcp) that you can then access from your DLL function. The structure of FMcontext can be found in the FilterMeister source code in the AfhFMcontext.h file. As the context record can change between FilterMeister versions, it is important that your DLL is designed to use the correct version of the context record for your plugin.

== Example ==

Example of called functions in a DLL:

<code>

__declspec(dllexport)

int MyForEveryTile(FMcontext *fmcp, int X, int Y) { return false; }

__declspec(dllexport)

double MyFloat(FMcontext *fmcp, int a, double x, double y) {

return a*(x - y);

}

</code>

To invoke these functions from FM:

<code>

int g_hMyDll = loadLib("MyDll");

if (!g_hMyDll) ERROR...

int g_pfnMyForEveryTile = getLibFn(g_hMyDll, "MyForEveryTile");

if (!g_pfnMyForEveryTile) ERROR...

int g_pfnMyFloat = getLibFn(g_hMyDll, "MyFloat");

if (!g_pfnMyFloat) ERROR...

int iRes = callLibFmc(g_pfnMyForEveryTile, 100, 200);

double fRes = fcallLibFmc(g_pfnMyFloat, 10, 1.2, 3.14);

</code>

== See Also ==

loadLib, getLibFn, fCallLib, fCallLibFmc, freeLib

== Comments ==

:Everyone can add their comments about their experiences with this function here. Tips for using it are welcome, too.