compiles example, segfaults by intention (disabled error handling, no plugin yet)

This commit is contained in:
Christian Thaeter 2007-07-19 06:15:55 +02:00
parent 5946d6961d
commit fdb691398d
6 changed files with 53 additions and 15 deletions

View file

@ -25,10 +25,18 @@ BUILT_SOURCES =
EXTRA_DIST =
SUBDIRS =
# Only use subdirs if really needed, prefer the include scheme below
#SUBDIRS +=
# core
include $(top_srcdir)/src/lib/Makefile.am
# plugins
#include $(top_srcdir)/src...
# tests
include $(top_srcdir)/tests/examples/Makefile.am
#EXTRA_DIST += admin debian doc depcomp README.BUILD LICENSE \
# cinelerra-cvs-current.spec
AUTOMAKE_OPTIONS=foreign

View file

@ -44,7 +44,7 @@ NOBUG_DEFINE_FLAG (cinelerra_plugin);
/* errors */
const char* CINELERRA_PLUGIN_SUCCESS = NULL;
const char* CINELERRA_PLUGIN_EDLOPEN = "Could not open plugin";
const char* CINELERRA_PLUGIN_EDHOOK = "Hook function failed";
const char* CINELERRA_PLUGIN_EHOOK = "Hook function failed";
const char* CINELERRA_PLUGIN_ENFOUND = "No such plugin";
const char* CINELERRA_PLUGIN_ENIFACE = "No such interface";
const char* CINELERRA_PLUGIN_EREVISION = "Interface revision too old";
@ -304,11 +304,13 @@ cinelerra_interface_open (const char* name, const char* interface, size_t min_re
}
void
cinelerra_interface_close (struct cinelerra_interface* self)
cinelerra_interface_close (void* ptr)
{
if(!self)
if(!ptr)
return;
struct cinelerra_interface* self = (struct cinelerra_interface*) ptr;
pthread_mutex_lock (&cinelerra_plugin_mutex);
struct cinelerra_plugin* plugin = self->plugin;

View file

@ -109,7 +109,7 @@ cinelerra_interface_open (const char* plugin, const char* name, size_t min_revis
* @param self interface to be closed
*/
void
cinelerra_interface_close (struct cinelerra_interface* self);
cinelerra_interface_close (void* self);
/**
* Tries to unload a plugin.

View file

@ -0,0 +1,26 @@
# Copyright (C) CinelerraCV
# 2007, Christian Thaeter <ct@pipapo.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
examples_srcdir = $(top_srcdir)/tests/examples
noinst_PROGRAMS += plugin_example
plugin_example_CFLAGS = $(CFLAGS) -std=gnu99 -Wall -Werror
plugin_example_CPPFLAGS = $(CPPFLAGS) -std=gnu99 -Wall -Werror -I$(top_srcdir)/src/lib/
plugin_example_LDADD = -lnobugmt -lpthread -ldl $(builddir)/libcin3.a
plugin_example_SOURCES = $(examples_srcdir)/plugin_main.c
noinst_HEADERS += $(examples_srcdir)/hello_interface.h

View file

@ -1,6 +1,6 @@
#include "plugin.h"
CINELERRA_INTERFACE(hello, 1,
CINELERRA_INTERFACE_PROTO(void, hello, (void)),
CINELERRA_INTERFACE_PROTO(void, goodbye, (const char*)),
CINELERRA_INTERFACE_PROTO(void, hello, (void))
CINELERRA_INTERFACE_PROTO(void, goodbye, (const char*))
);

View file

@ -12,20 +12,22 @@ main(int argc, char** argv)
open both try them, close them.
*/
struct hello_interface_1* hello_de =
cinelerra_interface_open ("hello_1", "german_1", sizeof(struct hello_interface_1));
if (!hello_de) CINELERRA_DIE;
TODO("macros, doing casting and typing");
hello_de->say_hello();
CINELERRA_INTERFACE_TYPE(hello, 1)* hello_de = (CINELERRA_INTERFACE_TYPE(hello, 1)*)
cinelerra_interface_open ("hello_1", "german_1", sizeof(CINELERRA_INTERFACE_TYPE(hello, 1)));
TODO("new error handling, when finished if (!hello_de) CINELERRA_DIE");
hello_de->hello();
struct hello_interface_1* hello_en =
cinelerra_interface_open ("hello_1", "english_1", sizeof(struct hello_interface_1));
if (!hello_en) CINELERRA_DIE;
// struct hello_interface_1* hello_en =
// cinelerra_interface_open ("hello_1", "english_1", sizeof(struct hello_interface_1));
// TODO if (!hello_en) CINELERRA_DIE;
hello_en->say_hello();
//hello_en->hello();
cinelerra_interface_close (hello_en);
//cinelerra_interface_close (hello_en);
cinelerra_interface_close (hello_de);
#if 0