2009-01-31 10:33:39 -08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
#include <Efl.h>
|
2009-01-31 10:33:39 -08:00
|
|
|
|
2006-01-06 05:56:47 -08:00
|
|
|
#include "Ecore.h"
|
2009-12-22 13:15:12 -08:00
|
|
|
#include "ecore_private.h"
|
2005-10-24 07:47:25 -07:00
|
|
|
|
2014-08-07 06:57:50 -07:00
|
|
|
#define MY_CLASS ECORE_EXE_CLASS
|
|
|
|
|
2014-08-26 08:48:07 -07:00
|
|
|
#include "ecore_exe_private.h"
|
2014-08-07 06:57:50 -07:00
|
|
|
|
2006-04-05 18:16:02 -07:00
|
|
|
/* TODO: Something to let people build a command line and does auto escaping -
|
|
|
|
*
|
|
|
|
* ecore_exe_snprintf()
|
|
|
|
*
|
|
|
|
* OR
|
|
|
|
*
|
|
|
|
* cmd = ecore_exe_comand_parameter_append(cmd, "firefox");
|
|
|
|
* cmd = ecore_exe_comand_parameter_append(cmd, "http://www.foo.com/bar.html?baz=yes");
|
2007-08-26 04:17:21 -07:00
|
|
|
* each parameter appended is one argument, and it gets escaped, quoted, and
|
2010-09-08 04:23:42 -07:00
|
|
|
* appended with a preceding space. The first is the command off course.
|
2006-04-05 18:16:02 -07:00
|
|
|
*/
|
|
|
|
|
2006-01-01 12:09:47 -08:00
|
|
|
struct _ecore_exe_dead_exe
|
|
|
|
{
|
2010-01-08 11:49:05 -08:00
|
|
|
pid_t pid;
|
|
|
|
char *cmd;
|
2006-01-01 12:09:47 -08:00
|
|
|
};
|
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API int ECORE_EXE_EVENT_ADD = 0;
|
|
|
|
ECORE_API int ECORE_EXE_EVENT_DEL = 0;
|
|
|
|
ECORE_API int ECORE_EXE_EVENT_DATA = 0;
|
|
|
|
ECORE_API int ECORE_EXE_EVENT_ERROR = 0;
|
2003-09-23 01:09:32 -07:00
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API void
|
2008-11-01 18:29:08 -07:00
|
|
|
ecore_exe_run_priority_set(int pri)
|
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN;
|
2014-08-27 03:00:11 -07:00
|
|
|
_impl_ecore_exe_run_priority_set(pri);
|
2008-11-01 18:29:08 -07:00
|
|
|
}
|
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API int
|
2008-11-01 18:29:08 -07:00
|
|
|
ecore_exe_run_priority_get(void)
|
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN_VAL(0);
|
2014-08-27 03:00:11 -07:00
|
|
|
return _impl_ecore_exe_run_priority_get();
|
2008-11-01 18:29:08 -07:00
|
|
|
}
|
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API Ecore_Exe *
|
2011-10-20 22:40:39 -07:00
|
|
|
ecore_exe_run(const char *exe_cmd,
|
|
|
|
const void *data)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL);
|
2006-01-10 08:46:07 -08:00
|
|
|
return ecore_exe_pipe_run(exe_cmd, 0, data);
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API Ecore_Exe *
|
2017-11-08 22:59:04 -08:00
|
|
|
ecore_exe_pipe_run(const char *exe_cmd,
|
|
|
|
Ecore_Exe_Flags flags,
|
|
|
|
const void *data)
|
2005-10-24 01:53:50 -07:00
|
|
|
{
|
2016-07-13 16:55:03 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL);
|
2018-02-27 04:19:17 -08:00
|
|
|
Ecore_Exe *ret = efl_add(MY_CLASS, efl_main_loop_get(),
|
2017-11-08 22:59:04 -08:00
|
|
|
ecore_obj_exe_command_set(efl_added, exe_cmd,
|
|
|
|
flags));
|
2014-08-07 06:57:50 -07:00
|
|
|
if (ret)
|
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
Ecore_Exe_Data *pd = efl_data_scope_get(ret, MY_CLASS);
|
2014-08-07 06:57:50 -07:00
|
|
|
pd->data = (void *) data;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
|
|
|
_ecore_exe_command_set(Eo *obj EINA_UNUSED, Ecore_Exe_Data *pd, const char *cmd, Ecore_Exe_Flags flags)
|
|
|
|
{
|
2016-04-05 04:53:02 -07:00
|
|
|
if (!cmd) return;
|
2014-08-07 06:57:50 -07:00
|
|
|
pd->cmd = strdup(cmd);
|
|
|
|
pd->flags = flags;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2018-04-17 11:09:44 -07:00
|
|
|
_ecore_exe_command_get(const Eo *obj EINA_UNUSED, Ecore_Exe_Data *pd, const char **cmd, Ecore_Exe_Flags *flags)
|
2014-08-07 06:57:50 -07:00
|
|
|
{
|
|
|
|
if (cmd) *cmd = pd->cmd;
|
|
|
|
if (flags) *flags = pd->flags;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eo *
|
2016-08-10 07:23:04 -07:00
|
|
|
_ecore_exe_efl_object_finalize(Eo *obj, Ecore_Exe_Data *exe)
|
2014-08-07 06:57:50 -07:00
|
|
|
{
|
2014-08-26 08:48:07 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL);
|
2016-08-15 06:44:41 -07:00
|
|
|
obj = efl_finalize(efl_super(obj, MY_CLASS));
|
2017-11-08 22:59:04 -08:00
|
|
|
if (!obj) return obj;
|
2016-08-10 07:23:04 -07:00
|
|
|
return _impl_ecore_exe_efl_object_finalize(obj, exe);
|
2005-10-24 01:53:50 -07:00
|
|
|
}
|
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API void
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_callback_pre_free_set(Ecore_Exe *obj,
|
2011-10-20 22:40:39 -07:00
|
|
|
Ecore_Exe_Cb func)
|
2010-01-05 21:16:59 -08:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN;
|
2016-08-15 06:44:41 -07:00
|
|
|
Ecore_Exe_Data *exe = efl_data_scope_get(obj, MY_CLASS);
|
2017-11-08 22:59:04 -08:00
|
|
|
if (!efl_isa(obj, MY_CLASS)) return;
|
2010-01-05 21:16:59 -08:00
|
|
|
exe->pre_free_cb = func;
|
|
|
|
}
|
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API Eina_Bool
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_send(Ecore_Exe *obj,
|
2011-10-20 22:40:39 -07:00
|
|
|
const void *data,
|
|
|
|
int size)
|
2005-10-24 01:53:50 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN_VAL(EINA_FALSE);
|
2016-08-15 06:44:41 -07:00
|
|
|
Ecore_Exe_Data *exe = efl_data_scope_get(obj, MY_CLASS);
|
2017-11-08 22:59:04 -08:00
|
|
|
if (!efl_isa(obj, MY_CLASS)) return EINA_FALSE;
|
2014-08-07 06:57:50 -07:00
|
|
|
|
2016-12-22 08:49:27 -08:00
|
|
|
EINA_SAFETY_ON_TRUE_RETURN_VAL(size == 0, EINA_TRUE);
|
2010-01-05 21:16:59 -08:00
|
|
|
if (exe->close_stdin)
|
2017-11-08 22:59:04 -08:00
|
|
|
{
|
|
|
|
ERR("Ecore_Exe %p stdin is closed! Cannot send %d bytes from %p",
|
|
|
|
exe, size, data);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2014-08-27 03:00:11 -07:00
|
|
|
return _impl_ecore_exe_send(obj, exe, data, size);
|
2005-10-24 01:53:50 -07:00
|
|
|
}
|
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API void
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_close_stdin(Ecore_Exe *obj)
|
2005-12-30 11:17:21 -08:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN;
|
2016-08-15 06:44:41 -07:00
|
|
|
Ecore_Exe_Data *exe = efl_data_scope_get(obj, MY_CLASS);
|
2017-11-08 22:59:04 -08:00
|
|
|
if (!efl_isa(obj, MY_CLASS)) return;
|
2006-01-04 12:53:07 -08:00
|
|
|
exe->close_stdin = 1;
|
2005-12-30 11:17:21 -08:00
|
|
|
}
|
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API void
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_auto_limits_set(Ecore_Exe *obj,
|
2011-10-20 22:40:39 -07:00
|
|
|
int start_bytes,
|
|
|
|
int end_bytes,
|
|
|
|
int start_lines,
|
|
|
|
int end_lines)
|
2006-01-16 05:21:52 -08:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN;
|
2016-08-15 06:44:41 -07:00
|
|
|
Ecore_Exe_Data *exe = efl_data_scope_get(obj, MY_CLASS);
|
2017-11-08 22:59:04 -08:00
|
|
|
if (!efl_isa(obj, MY_CLASS)) return;
|
|
|
|
_impl_ecore_exe_auto_limits_set(obj, exe, start_bytes, end_bytes,
|
|
|
|
start_lines, end_lines);
|
2006-01-16 05:21:52 -08:00
|
|
|
}
|
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API Ecore_Exe_Event_Data *
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_event_data_get(Ecore_Exe *obj,
|
2011-10-20 22:40:39 -07:00
|
|
|
Ecore_Exe_Flags flags)
|
2006-01-16 05:21:52 -08:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL);
|
2016-08-15 06:44:41 -07:00
|
|
|
Ecore_Exe_Data *exe = efl_data_scope_get(obj, MY_CLASS);
|
2017-11-08 22:59:04 -08:00
|
|
|
if (!efl_isa(obj, MY_CLASS)) return NULL;
|
2014-08-27 03:00:11 -07:00
|
|
|
return _impl_ecore_exe_event_data_get(obj, exe, flags);
|
2006-01-16 05:21:52 -08:00
|
|
|
}
|
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API void
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_tag_set(Ecore_Exe *obj,
|
2011-10-20 22:40:39 -07:00
|
|
|
const char *tag)
|
2005-09-28 06:09:09 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN;
|
2016-08-15 06:44:41 -07:00
|
|
|
Ecore_Exe_Data *exe = efl_data_scope_get(obj, MY_CLASS);
|
2017-11-08 22:59:04 -08:00
|
|
|
if (!efl_isa(obj, MY_CLASS)) return;
|
2005-12-24 04:13:12 -08:00
|
|
|
IF_FREE(exe->tag);
|
2017-11-08 22:59:04 -08:00
|
|
|
if (tag) exe->tag = strdup(tag);
|
|
|
|
else exe->tag = NULL;
|
2005-09-28 06:09:09 -07:00
|
|
|
}
|
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API const char *
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_tag_get(const Ecore_Exe *obj)
|
2005-09-28 06:09:09 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL);
|
2016-08-15 06:44:41 -07:00
|
|
|
Ecore_Exe_Data *exe = efl_data_scope_get(obj, MY_CLASS);
|
2017-11-08 22:59:04 -08:00
|
|
|
if (!efl_isa(obj, MY_CLASS)) return NULL;
|
2005-09-28 06:09:09 -07:00
|
|
|
return exe->tag;
|
|
|
|
}
|
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API void *
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_free(Ecore_Exe *obj)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL);
|
2016-08-15 06:44:41 -07:00
|
|
|
Ecore_Exe_Data *exe = efl_data_scope_get(obj, MY_CLASS);
|
2017-11-08 22:59:04 -08:00
|
|
|
if (!efl_isa(obj, MY_CLASS)) return NULL;
|
2014-08-26 08:36:25 -07:00
|
|
|
void *data = exe->data;
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_del(obj);
|
2014-08-26 08:36:25 -07:00
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2016-08-10 07:23:04 -07:00
|
|
|
_ecore_exe_efl_object_destructor(Eo *obj, Ecore_Exe_Data *exe)
|
2014-08-26 08:36:25 -07:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_destructor(efl_super(obj, ECORE_EXE_CLASS));
|
2016-08-10 07:23:04 -07:00
|
|
|
_impl_ecore_exe_efl_object_destructor(obj, exe);
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API void
|
2009-12-06 19:06:50 -08:00
|
|
|
ecore_exe_event_data_free(Ecore_Exe_Event_Data *e)
|
2006-01-16 05:21:52 -08:00
|
|
|
{
|
2010-01-05 21:16:59 -08:00
|
|
|
if (!e) return;
|
2006-01-16 05:21:52 -08:00
|
|
|
IF_FREE(e->lines);
|
|
|
|
IF_FREE(e->data);
|
|
|
|
free(e);
|
|
|
|
}
|
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API pid_t
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_pid_get(const Ecore_Exe *obj)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN_VAL(0);
|
2016-08-15 06:44:41 -07:00
|
|
|
Ecore_Exe_Data *exe = efl_data_scope_get(obj, MY_CLASS);
|
2017-11-08 22:59:04 -08:00
|
|
|
if (!efl_isa(obj, MY_CLASS)) return -1;
|
2003-09-23 01:09:32 -07:00
|
|
|
return exe->pid;
|
|
|
|
}
|
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API const char *
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_cmd_get(const Ecore_Exe *obj)
|
2006-04-15 05:44:31 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL);
|
2014-08-07 06:57:50 -07:00
|
|
|
const char *ret = NULL;
|
2016-03-01 10:06:28 -08:00
|
|
|
ecore_obj_exe_command_get(obj, &ret, NULL);
|
2014-08-07 06:57:50 -07:00
|
|
|
return ret;
|
2006-04-15 05:44:31 -07:00
|
|
|
}
|
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API void *
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_data_get(const Ecore_Exe *obj)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL);
|
2016-08-15 06:44:41 -07:00
|
|
|
Ecore_Exe_Data *exe = efl_data_scope_get(obj, MY_CLASS);
|
2017-11-08 22:59:04 -08:00
|
|
|
if (!efl_isa(obj, MY_CLASS)) return NULL;
|
2003-09-23 01:09:32 -07:00
|
|
|
return exe->data;
|
|
|
|
}
|
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API void *
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_data_set(Ecore_Exe *obj,
|
2011-10-20 22:40:39 -07:00
|
|
|
void *data)
|
2011-04-19 14:38:24 -07:00
|
|
|
{
|
|
|
|
void *ret;
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL);
|
2016-08-15 06:44:41 -07:00
|
|
|
Ecore_Exe_Data *exe = efl_data_scope_get(obj, MY_CLASS);
|
2017-11-08 22:59:04 -08:00
|
|
|
if (!efl_isa(obj, MY_CLASS)) return NULL;
|
2011-04-19 14:38:24 -07:00
|
|
|
ret = exe->data;
|
|
|
|
exe->data = data;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API Ecore_Exe_Flags
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_flags_get(const Ecore_Exe *obj)
|
2010-01-03 13:55:50 -08:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN_VAL(0);
|
2016-08-15 06:44:41 -07:00
|
|
|
Ecore_Exe_Data *exe = efl_data_scope_get(obj, MY_CLASS);
|
2017-11-08 22:59:04 -08:00
|
|
|
if (!efl_isa(obj, MY_CLASS)) return 0;
|
2010-01-03 13:55:50 -08:00
|
|
|
return exe->flags;
|
|
|
|
}
|
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API void
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_pause(Ecore_Exe *obj)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2016-03-01 10:06:28 -08:00
|
|
|
efl_control_suspend_set(obj, EINA_TRUE);
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API void
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_continue(Ecore_Exe *obj)
|
2014-08-08 07:13:05 -07:00
|
|
|
{
|
2016-03-01 10:06:28 -08:00
|
|
|
efl_control_suspend_set(obj, EINA_FALSE);
|
2014-08-08 07:13:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
|
|
|
_ecore_exe_efl_control_suspend_set(Eo *obj EINA_UNUSED, Ecore_Exe_Data *exe, Eina_Bool suspend)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN;
|
2017-11-08 22:59:04 -08:00
|
|
|
if (suspend) _impl_ecore_exe_pause(obj, exe);
|
|
|
|
else _impl_ecore_exe_continue(obj, exe);
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API void
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_interrupt(Ecore_Exe *obj)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN;
|
2016-08-15 06:44:41 -07:00
|
|
|
Ecore_Exe_Data *exe = efl_data_scope_get(obj, MY_CLASS);
|
2017-11-08 22:59:04 -08:00
|
|
|
if (!efl_isa(obj, MY_CLASS)) return;
|
2014-08-27 03:00:11 -07:00
|
|
|
_impl_ecore_exe_interrupt(obj, exe);
|
2008-07-29 15:07:19 -07:00
|
|
|
}
|
2006-01-01 12:09:47 -08:00
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API void
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_quit(Ecore_Exe *obj)
|
2008-07-29 15:07:19 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN;
|
2016-08-15 06:44:41 -07:00
|
|
|
Ecore_Exe_Data *exe = efl_data_scope_get(obj, MY_CLASS);
|
2017-11-08 22:59:04 -08:00
|
|
|
if (!efl_isa(obj, MY_CLASS)) return;
|
2014-08-27 03:00:11 -07:00
|
|
|
_impl_ecore_exe_quit(obj, exe);
|
2008-07-29 15:07:19 -07:00
|
|
|
}
|
2006-01-10 08:46:07 -08:00
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API void
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_terminate(Ecore_Exe *obj)
|
2008-07-29 15:07:19 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN;
|
2016-08-15 06:44:41 -07:00
|
|
|
Ecore_Exe_Data *exe = efl_data_scope_get(obj, MY_CLASS);
|
2017-11-08 22:59:04 -08:00
|
|
|
if (!efl_isa(obj, MY_CLASS)) return;
|
2014-08-27 03:00:11 -07:00
|
|
|
_impl_ecore_exe_terminate(obj, exe);
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API void
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_kill(Ecore_Exe *obj)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN;
|
2016-08-15 06:44:41 -07:00
|
|
|
Ecore_Exe_Data *exe = efl_data_scope_get(obj, MY_CLASS);
|
2017-11-08 22:59:04 -08:00
|
|
|
if (!efl_isa(obj, MY_CLASS)) return;
|
2014-08-27 03:00:11 -07:00
|
|
|
_impl_ecore_exe_kill(obj, exe);
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API void
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_signal(Ecore_Exe *obj,
|
2011-10-20 22:40:39 -07:00
|
|
|
int num)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN;
|
2016-08-15 06:44:41 -07:00
|
|
|
Ecore_Exe_Data *exe = efl_data_scope_get(obj, MY_CLASS);
|
2017-11-08 22:59:04 -08:00
|
|
|
if (!efl_isa(obj, MY_CLASS)) return;
|
2014-08-27 03:00:11 -07:00
|
|
|
_impl_ecore_exe_signal(obj, exe, num);
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
ECORE_API void
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_hup(Ecore_Exe *obj)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN;
|
2016-08-15 06:44:41 -07:00
|
|
|
Ecore_Exe_Data *exe = efl_data_scope_get(obj, MY_CLASS);
|
2017-11-08 22:59:04 -08:00
|
|
|
if (!efl_isa(obj, MY_CLASS)) return;
|
2014-08-27 03:00:11 -07:00
|
|
|
_impl_ecore_exe_hup(obj, exe);
|
2006-01-01 12:09:47 -08:00
|
|
|
}
|
|
|
|
|
2006-01-12 20:31:41 -08:00
|
|
|
void
|
|
|
|
_ecore_exe_init(void)
|
|
|
|
{
|
2006-01-13 05:18:36 -08:00
|
|
|
ECORE_EXE_EVENT_ADD = ecore_event_type_new();
|
|
|
|
ECORE_EXE_EVENT_DEL = ecore_event_type_new();
|
|
|
|
ECORE_EXE_EVENT_DATA = ecore_event_type_new();
|
|
|
|
ECORE_EXE_EVENT_ERROR = ecore_event_type_new();
|
2006-01-12 20:31:41 -08:00
|
|
|
}
|
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
void
|
|
|
|
_ecore_exe_shutdown(void)
|
|
|
|
{
|
2014-08-07 06:57:50 -07:00
|
|
|
Ecore_Exe *exe = NULL;
|
|
|
|
Eina_List *l1, *l2;
|
2017-11-08 22:59:04 -08:00
|
|
|
Efl_Loop_Data *loop = EFL_LOOP_DATA;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH_SAFE(loop->exes, l1, l2, exe)
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_free(exe);
|
2017-03-09 16:08:59 -08:00
|
|
|
|
|
|
|
ecore_event_type_flush(ECORE_EXE_EVENT_ADD,
|
|
|
|
ECORE_EXE_EVENT_DEL,
|
|
|
|
ECORE_EXE_EVENT_DATA,
|
|
|
|
ECORE_EXE_EVENT_ERROR);
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
|
|
|
|
2009-12-06 19:06:50 -08:00
|
|
|
Ecore_Exe *
|
2003-09-23 01:09:32 -07:00
|
|
|
_ecore_exe_find(pid_t pid)
|
|
|
|
{
|
2014-08-07 06:57:50 -07:00
|
|
|
Eina_List *itr;
|
|
|
|
Ecore_Exe *obj;
|
2017-11-08 22:59:04 -08:00
|
|
|
Efl_Loop_Data *loop = EFL_LOOP_DATA;
|
2009-12-06 19:06:50 -08:00
|
|
|
|
2017-11-08 22:59:04 -08:00
|
|
|
EINA_LIST_FOREACH(loop->exes, itr, obj)
|
|
|
|
{
|
|
|
|
Ecore_Exe_Data *exe = efl_data_scope_get(obj, MY_CLASS);
|
|
|
|
if (exe->pid == pid) return obj;
|
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
void *
|
|
|
|
_ecore_exe_event_del_new(void)
|
2005-12-10 14:39:51 -08:00
|
|
|
{
|
2017-11-08 22:59:04 -08:00
|
|
|
Ecore_Exe_Event_Del *e = calloc(1, sizeof(Ecore_Exe_Event_Del));
|
2014-08-27 03:00:11 -07:00
|
|
|
return e;
|
2005-12-10 14:39:51 -08:00
|
|
|
}
|
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
void
|
|
|
|
_ecore_exe_event_del_free(void *data EINA_UNUSED,
|
|
|
|
void *ev)
|
2005-12-10 14:39:51 -08:00
|
|
|
{
|
2017-11-08 22:59:04 -08:00
|
|
|
Ecore_Exe_Event_Del *e = ev;
|
|
|
|
if (e->exe) ecore_exe_free(e->exe);
|
2014-08-27 03:00:11 -07:00
|
|
|
free(e);
|
2005-12-10 14:39:51 -08:00
|
|
|
}
|
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
void
|
2012-11-25 01:55:32 -08:00
|
|
|
_ecore_exe_event_exe_data_free(void *data EINA_UNUSED,
|
2011-10-20 22:40:39 -07:00
|
|
|
void *ev)
|
2005-12-10 14:39:51 -08:00
|
|
|
{
|
2017-11-08 22:59:04 -08:00
|
|
|
Ecore_Exe_Event_Data *e = ev;
|
2006-01-16 05:21:52 -08:00
|
|
|
ecore_exe_event_data_free(e);
|
2005-12-10 14:39:51 -08:00
|
|
|
}
|
2006-01-13 05:18:36 -08:00
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
Ecore_Exe_Event_Add *
|
2006-01-13 05:18:36 -08:00
|
|
|
_ecore_exe_event_add_new(void)
|
|
|
|
{
|
2017-11-08 22:59:04 -08:00
|
|
|
Ecore_Exe_Event_Add *e = calloc(1, sizeof(Ecore_Exe_Event_Add));
|
2006-01-13 05:18:36 -08:00
|
|
|
return e;
|
|
|
|
}
|
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
void
|
2012-11-25 01:55:32 -08:00
|
|
|
_ecore_exe_event_add_free(void *data EINA_UNUSED,
|
2011-10-20 22:40:39 -07:00
|
|
|
void *ev)
|
2006-01-13 05:18:36 -08:00
|
|
|
{
|
2017-11-08 22:59:04 -08:00
|
|
|
Ecore_Exe_Event_Add *e = ev;
|
2006-01-13 05:18:36 -08:00
|
|
|
free(e);
|
|
|
|
}
|
2006-01-15 19:20:36 -08:00
|
|
|
|
2019-03-06 11:06:16 -08:00
|
|
|
#include "ecore_exe_eo.c"
|