summaryrefslogtreecommitdiff
path: root/modules/dynamic_link/includes
diff options
context:
space:
mode:
authorShashank2017-05-29 12:40:26 +0530
committerShashank2017-05-29 12:40:26 +0530
commit0345245e860375a32c9a437c4a9d9cae807134e9 (patch)
treead51ecbfa7bcd3cc5f09834f1bb8c08feaa526a4 /modules/dynamic_link/includes
downloadscilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.gz
scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.bz2
scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.zip
CMSCOPE changed
Diffstat (limited to 'modules/dynamic_link/includes')
-rwxr-xr-xmodules/dynamic_link/includes/GetFunctionByName.h42
-rwxr-xr-xmodules/dynamic_link/includes/addinter.h55
-rwxr-xr-xmodules/dynamic_link/includes/dynamic_link.h133
-rwxr-xr-xmodules/dynamic_link/includes/dynamiclibrary.h22
-rwxr-xr-xmodules/dynamic_link/includes/dynamiclibrary_others.h52
-rwxr-xr-xmodules/dynamic_link/includes/dynamiclibrary_windows.h60
-rwxr-xr-xmodules/dynamic_link/includes/dynlib_dynamic_link.h29
-rwxr-xr-xmodules/dynamic_link/includes/gw_dynamic_link.h35
-rwxr-xr-xmodules/dynamic_link/includes/ilib_verbose.h48
9 files changed, 476 insertions, 0 deletions
diff --git a/modules/dynamic_link/includes/GetFunctionByName.h b/modules/dynamic_link/includes/GetFunctionByName.h
new file mode 100755
index 000000000..e9b587d9c
--- /dev/null
+++ b/modules/dynamic_link/includes/GetFunctionByName.h
@@ -0,0 +1,42 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) INRIA - Allan CORNET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+ *
+ */
+
+/*--------------------------------------------------------------------------*/
+#ifndef __GETFUNCTIONBYNAME_H__
+#define __GETFUNCTIONBYNAME_H__
+
+#include "dynlib_dynamic_link.h"
+
+typedef void (*voidf)();
+
+/* structure entry in functions table */
+
+typedef struct
+{
+ char *name; /* function name */
+ voidf f; /* pointer on function */
+} FTAB;
+
+
+/**
+* Gets a pointer to a C or Fortran function by name from the functions table
+*
+* @param name function name
+* @param[OUT] rep result 1 (OK) or 0 (Problem)
+* @param table functions hashtable
+* @return a pointer on function in functions hashtable
+*/
+DYNAMIC_LINK_IMPEXP voidf GetFunctionByName (char *name, int *rep, FTAB *table);
+
+#endif /* __GETFUNCTIONBYNAME_H__ */
+/*--------------------------------------------------------------------------*/
+
diff --git a/modules/dynamic_link/includes/addinter.h b/modules/dynamic_link/includes/addinter.h
new file mode 100755
index 000000000..cf76755ee
--- /dev/null
+++ b/modules/dynamic_link/includes/addinter.h
@@ -0,0 +1,55 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) INRIA - Allan CORNET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+ *
+ */
+
+#ifndef __ADDINTER_H__
+#define __ADDINTER_H__
+
+#include "dynlib_dynamic_link.h"
+#include "machine.h"
+
+/**
+* the first dynamic interface is at position 500+1
+*/
+#define DynInterfStart 500
+
+#define NumberMaxFunctionsByGateway 1000
+
+#define MAXDYNINTERF 50 /* default value compatibility scilab 4.x */
+/* !!! WARNING !!! */
+/* On Windows , AddInterfaceToScilab based on LoadLibrary C function */
+/* you cannot load more than 80 dynamic libraries at the same time. */
+/* Scilab will return a error (code Windows 1114) in this case.*/
+/* A dynamic link library (DLL) initialization routine failed. */
+
+
+/**
+* Remove interface in scilab
+* @param[in] id of interface
+*/
+DYNAMIC_LINK_IMPEXP void RemoveInterf(int id);
+
+/**
+* Add a interface in Scilab
+* @param[in] filenamelib dynamic libraries filename
+* @param[in] spname Name of interface routine entry point
+* @param[in] fcts Name of new Scilab function implemented in the new interface
+* @param[in] sizefcts size of fcts array
+* @return a int id of interface (-1 failed)
+*/
+DYNAMIC_LINK_IMPEXP int AddInterfaceToScilab(char *filenamelib, char *spname, char **fcts, int sizefcts);
+
+/**
+* TO DO: comments
+*/
+DYNAMIC_LINK_IMPEXP void C2F(userlk)(int *k);
+
+#endif /* __ADDINTER_H__ */
diff --git a/modules/dynamic_link/includes/dynamic_link.h b/modules/dynamic_link/includes/dynamic_link.h
new file mode 100755
index 000000000..fcfa36c06
--- /dev/null
+++ b/modules/dynamic_link/includes/dynamic_link.h
@@ -0,0 +1,133 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) INRIA - Allan CORNET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+ *
+ */
+
+/*-----------------------------------------------------------------------------------*/
+#ifndef __DYNAMIC_LINK_H__
+#define __DYNAMIC_LINK_H__
+
+#include "dynlib_dynamic_link.h"
+#include "BOOL.h"
+#include "machine.h" /* C2F */
+
+#define ENTRYMAX 500
+
+/**
+* Initialize tables
+*/
+DYNAMIC_LINK_IMPEXP void initializeLink(void);
+
+/**
+* check that a routine name is a loaded
+* if *ilib == -1
+* checks if routinename is a loaded
+* entry point
+* the result is -1 if false
+* or the number in the function table
+*
+* @param[in] routinename
+* @param[in/out] ilib number in the function table (-1 if FALSE)
+* @return a BOOL
+*/
+DYNAMIC_LINK_IMPEXP BOOL c_link(char *routinename, int *ilib);
+
+/**
+* OBSOLETE
+* if *ilib == -1
+* checks if routinename is a loaded
+* entry point
+* the result is -1 if false
+* or the number in the function table
+* @param[in] routinename
+* @param[in/out] ilib
+*/
+DYNAMIC_LINK_IMPEXP void C2F(iislink) (char *routinename, int *ilib);
+
+/**
+* returns the ii functions
+* @param ii
+* @param ptr on functions
+*/
+DYNAMIC_LINK_IMPEXP void GetDynFunc(int ii, void (**realop) ());
+
+/**
+* Search a function in the table
+* Search from end to top
+* @param
+* @param
+*/
+DYNAMIC_LINK_IMPEXP int SearchInDynLinks(char *op, void (**realop) ());
+
+/**
+* Show the linked files
+*/
+DYNAMIC_LINK_IMPEXP void ShowDynLinks(void);
+
+/**
+* unlink all linked files
+*/
+DYNAMIC_LINK_IMPEXP void unlinkallsharedlib(void);
+
+/**
+* Unlink a shared lib
+* @param i (number of shared lib)
+*/
+DYNAMIC_LINK_IMPEXP void unlinksharedlib(int *i);
+
+/**
+* load a shared archive and call LoadDynLibrary
+* the shared lib handler is stored in a Table
+* return value is == -1 if the LoadDynLibrary failed
+* @param loaded_file
+*/
+DYNAMIC_LINK_IMPEXP int Sci_dlopen(char *loaded_file);
+
+/**
+* This routine load the entryname ename
+* from shared lib ishared
+* @return TRUE or FALSE
+*/
+DYNAMIC_LINK_IMPEXP int Sci_dlsym(char *ename, int ishared, char *strf);
+
+/**
+* Delete entry points associated with shared lib ishared
+* then delete the shared lib
+@param ishared
+*/
+DYNAMIC_LINK_IMPEXP void Sci_Delsym(int ishared);
+
+/**
+* @param sizearray returns size of string array returned
+* @return string array with functions names loaded
+*/
+DYNAMIC_LINK_IMPEXP char **getNamesOfFunctionsInSharedLibraries(int *sizearray);
+
+/**
+* call link for scilab
+* @param idsharedlibrary
+* @param filename (dynamic library name)
+* @param subnamesarray (list of functions name in dynamic library)
+* @param sizesubnamesarray
+* @param fflag
+* @param ierr (last error)
+* @return id
+*/
+DYNAMIC_LINK_IMPEXP int scilabLink(int idsharedlibrary, char *filename, char **subnamesarray, int sizesubnamesarray, BOOL fflag, int *ierr);
+
+/**
+* get list of all Id of shared lib
+* @param size of returned list
+* @return list of Id
+*/
+DYNAMIC_LINK_IMPEXP int *getAllIdSharedLib(int *sizeList);
+
+#endif /* __DYNAMIC_LINK_H__ */
+/*-----------------------------------------------------------------------------------*/
diff --git a/modules/dynamic_link/includes/dynamiclibrary.h b/modules/dynamic_link/includes/dynamiclibrary.h
new file mode 100755
index 000000000..06a4f61a6
--- /dev/null
+++ b/modules/dynamic_link/includes/dynamiclibrary.h
@@ -0,0 +1,22 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2007 - INRIA - Allan CORNET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+ *
+ */
+#ifndef __DYNAMICLIBRARY_H__
+#define __DYNAMICLIBRARY_H__
+
+#ifdef _MSC_VER
+#include "dynamiclibrary_windows.h"
+#else
+#include "dynamiclibrary_others.h"
+#endif
+
+#endif /* __DYNAMICLIBRARY_H__ */
+/*---------------------------------------------------------------------------*/
diff --git a/modules/dynamic_link/includes/dynamiclibrary_others.h b/modules/dynamic_link/includes/dynamiclibrary_others.h
new file mode 100755
index 000000000..e662ce854
--- /dev/null
+++ b/modules/dynamic_link/includes/dynamiclibrary_others.h
@@ -0,0 +1,52 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2007-2008 - INRIA - Allan CORNET
+ * Copyright (C) 2007-2008 - INRIA - Sylvestre LEDRU
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+ *
+ */
+#ifndef __DYNAMICLIBRARY_OTHERS_H__
+#define __DYNAMICLIBRARY_OTHERS_H__
+
+#include <dlfcn.h>
+#include "BOOL.h" /* BOOL */
+
+typedef void * DynLibHandle;
+typedef void * DynLibFuncPtr;
+
+/**
+* Maps the specified executable module into the address space of the calling process
+* @param name of dynamic library
+* @return Handle to the loaded library
+*/
+#define LoadDynLibrary(libname) (DynLibHandle) dlopen(libname, RTLD_NOW | RTLD_GLOBAL);
+
+/**
+* Decrements the reference count of the loaded dynamic-link library
+* @param Handle to the loaded library
+* @return BOOL If the function succeeds, the return value is nonzero
+*/
+BOOL FreeDynLibrary(DynLibHandle hInstance);
+
+/**
+* Retrieves the address of an exported function
+* @param Handle to the loaded library
+* @param string that specifies the function
+* @return a pointer
+*/
+DynLibFuncPtr GetDynLibFuncPtr(DynLibHandle hInstance, char *funcName);
+
+/**
+* return last dynamic linking error
+* @return a string
+*/
+#define GetLastDynLibError() dlerror()
+
+#endif /* __DYNAMICLIBRARY_OTHERS_H__ */
+
+
diff --git a/modules/dynamic_link/includes/dynamiclibrary_windows.h b/modules/dynamic_link/includes/dynamiclibrary_windows.h
new file mode 100755
index 000000000..0a55862f8
--- /dev/null
+++ b/modules/dynamic_link/includes/dynamiclibrary_windows.h
@@ -0,0 +1,60 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2007 - INRIA - Allan CORNET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+ *
+ */
+#ifndef __DYNAMICLIBRARY_WINDOWS_H__
+#define __DYNAMICLIBRARY_WINDOWS_H__
+
+#include <Windows.h>
+#include "dynlib_dynamic_link.h"
+
+#include "BOOL.h"
+
+typedef HINSTANCE DynLibHandle;
+typedef FARPROC DynLibFuncPtr;
+
+/**
+* Maps the specified executable module into the address space of the calling process
+* @param name of dynamic library
+* @return Handle to the loaded library
+*/
+DYNAMIC_LINK_IMPEXP DynLibHandle LoadDynLibrary(char *libname);
+
+/**
+* Maps the specified executable module into the address space of the calling process
+* @param name of dynamic library (wide char)
+* @return Handle to the loaded library
+*/
+DYNAMIC_LINK_IMPEXP DynLibHandle LoadDynLibraryW(wchar_t *libname);
+
+
+/**
+* Decrements the reference count of the loaded dynamic-link library
+* @param Handle to the loaded library
+* @return BOOL If the function succeeds, the return value is nonzero
+*/
+DYNAMIC_LINK_IMPEXP BOOL FreeDynLibrary(DynLibHandle hInstance);
+
+/**
+* Retrieves the address of an exported function
+* @param Handle to the loaded library
+* @param string that specifies the function
+* @return
+*/
+DYNAMIC_LINK_IMPEXP DynLibFuncPtr GetDynLibFuncPtr(DynLibHandle hInstance, char *funcName);
+
+/**
+* return last dynamic linking error
+* @return a string
+*/
+DYNAMIC_LINK_IMPEXP char * GetLastDynLibError(void);
+
+#endif /* __DYNAMICLIBRARY_WINDOWS_H__ */
+
diff --git a/modules/dynamic_link/includes/dynlib_dynamic_link.h b/modules/dynamic_link/includes/dynlib_dynamic_link.h
new file mode 100755
index 000000000..cd37f5617
--- /dev/null
+++ b/modules/dynamic_link/includes/dynlib_dynamic_link.h
@@ -0,0 +1,29 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) DIGITEO - 2009 - Allan CORNET
+*
+* This file must be used under the terms of the CeCILL.
+* This source file is licensed as described in the file COPYING, which
+* you should have received as part of this distribution. The terms
+* are also available at
+* http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+*
+*/
+
+/*--------------------------------------------------------------------------*/
+#ifndef __DYNLIB_DYNAMIC_LINK_H__
+#define __DYNLIB_DYNAMIC_LINK_H__
+
+#ifdef _MSC_VER
+#ifdef DYNAMIC_LINK_EXPORTS
+#define DYNAMIC_LINK_IMPEXP __declspec(dllexport)
+#else
+#define DYNAMIC_LINK_IMPEXP __declspec(dllimport)
+#endif
+#else
+#define DYNAMIC_LINK_IMPEXP
+#endif
+
+#endif /* __DYNLIB_DYNAMIC_LINK_H__ */
+/*--------------------------------------------------------------------------*/
+
diff --git a/modules/dynamic_link/includes/gw_dynamic_link.h b/modules/dynamic_link/includes/gw_dynamic_link.h
new file mode 100755
index 000000000..dc0bf08ba
--- /dev/null
+++ b/modules/dynamic_link/includes/gw_dynamic_link.h
@@ -0,0 +1,35 @@
+
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) INRIA - Allan CORNET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+ *
+ */
+
+/*--------------------------------------------------------------------------*/
+#ifndef __GW_DYNAMIC_LINK__
+#define __GW_DYNAMIC_LINK__
+
+#include "dynlib_dynamic_link.h"
+/*--------------------------------------------------------------------------*/
+DYNAMIC_LINK_IMPEXP int gw_dynamic_link(void);
+/*--------------------------------------------------------------------------*/
+/* Declaration of all the profile function declared and */
+/* used in sci_gateway */
+/*--------------------------------------------------------------------------*/
+DYNAMIC_LINK_IMPEXP int sci_getdynlibext(char *fname, unsigned long fname_len);
+DYNAMIC_LINK_IMPEXP int sci_addinter(char *fname, unsigned long fname_len);
+DYNAMIC_LINK_IMPEXP int sci_fort(char *fname, unsigned long fname_len);
+DYNAMIC_LINK_IMPEXP int sci_call(char *fname, unsigned long fname_len);
+DYNAMIC_LINK_IMPEXP int sci_link(char *fname, unsigned long fname_len);
+DYNAMIC_LINK_IMPEXP int sci_ulink(char *fname, unsigned long fname_len);
+DYNAMIC_LINK_IMPEXP int sci_c_link(char *fname, unsigned long fname_len);
+DYNAMIC_LINK_IMPEXP int sci_ilib_verbose(char *fname, unsigned long fname_len);
+/*--------------------------------------------------------------------------*/
+#endif /* __GW_DYNAMIC_LINK__ */
+/*--------------------------------------------------------------------------*/
diff --git a/modules/dynamic_link/includes/ilib_verbose.h b/modules/dynamic_link/includes/ilib_verbose.h
new file mode 100755
index 000000000..4ff579068
--- /dev/null
+++ b/modules/dynamic_link/includes/ilib_verbose.h
@@ -0,0 +1,48 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) DIGITEO - 2009 - Allan CORNET
+*
+* This file must be used under the terms of the CeCILL.
+* This source file is licensed as described in the file COPYING, which
+* you should have received as part of this distribution. The terms
+* are also available at
+* http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+*
+*/
+
+/*---------------------------------------------------------------------------*/
+#ifndef __ILIB_VERBOSE_H__
+#define __ILIB_VERBOSE_H__
+
+#include "dynlib_dynamic_link.h"
+#include "BOOL.h"
+#include "machine.h"
+
+typedef enum
+{
+ ILIB_VERBOSE_NO_OUTPUT = 0,
+ ILIB_VERBOSE_STANDARD = 1,
+ ILIB_VERBOSE_MAX = 2
+} ilib_verbose_level;
+
+/**
+* set verbose level for dynamic link functions
+* @param[in] level
+* @return TRUE if level is modified
+*/
+DYNAMIC_LINK_IMPEXP BOOL setIlibVerboseLevel(ilib_verbose_level _level);
+
+/**
+* get verbose level for dynamic link functions
+* @return level
+*/
+DYNAMIC_LINK_IMPEXP ilib_verbose_level getIlibVerboseLevel(void);
+
+/**
+* get verbose level for dynamic link functions (for fortran external subroutines)
+* @param[out] level
+*/
+DYNAMIC_LINK_IMPEXP int C2F(getilibverboselevel)(int *_level);
+
+#endif /* __ILIB_VERBOSE_H__ */
+/*---------------------------------------------------------------------------*/