SA-MP Forums Archive
How to call/share functions between plugins? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Plugin Development (https://sampforum.blast.hk/forumdisplay.php?fid=18)
+--- Thread: How to call/share functions between plugins? (/showthread.php?tid=72354)



How to call/share functions between plugins? - Nubotron - 08.04.2009

Hi,

I want to call function of a plugin, inside another plugin. Is possible? If yes, can you describe how do, and there is plugin order for loading in samp server?

Thanks


Re: How to call/share functions between plugins? - ICECOLDKILLAK8 - 08.04.2009

I dont think its possible


Re: How to call/share functions between plugins? - Nubotron - 08.04.2009

Well, it is possible with Pawn so i really think it is possible with C or C++ maybe. Nobody know?


Re: How to call/share functions between plugins? - roleplayman - 09.04.2009

you can do that using DLL Export/Import functions

Quote:

C Language Reference
DLL Import and Export Functions

Microsoft Specific

The most complete and up-to-date information on this topic can be found in dllexport, dllimport.

The dllimport and dllexport storage-class modifiers are Microsoft-specific extensions to the C language. These modifiers explicitly define the DLL's interface to its client (the executable file or another DLL). Declaring functions as dllexport eliminates the need for a module-definition (.DEF) file. You can also use the dllimport and dllexport modifiers with data and objects.

The dllimport and dllexport storage-class modifiers must be used with the extended attribute syntax keyword, __declspec, as shown in this example:

Code:
#define DllImport __declspec( dllimport )
#define DllExport __declspec( dllexport )

DllExport void func();
DllExport int i = 10;
DllExport int j;
DllExport int n;

DllImport Int Func();
DllImport float axi = 0.0;
Source:http://msdn.microsoft.com/en-us/libr...ae(VS.80).aspx

Tell me if it helped



Re: How to call/share functions between plugins? - boylett - 09.04.2009

What about Linux?


Re: How to call/share functions between plugins? - ICECOLDKILLAK8 - 09.04.2009

Or you could use the .def file, That way it would work on Linux and Windows