[MPlayer-dev-eng] Exporting functions and types
Diego Biurrun
diego at silver.semantics.de
Tue Sep 23 17:42:33 CEST 2003
Please don't send HTML mail if you want to get a response.
Diego
savignien hercule writes:
> <STYLE>table.mail_content {DISPLAY: block}</STYLE><table width="100%" class="mail_content"><tr><td valign="top"><div><divRE>Well the problem appeared when I tried to compile the subrip tool of mplayer.
> This tools needs an spudec_handle_t type to work. The original type is
> defined in spudec.c file.If you #include the spudec.c file in subrip.c,
> it doesn't compile because of others type. Even in moving the spudec_handle_t declaration
> in the spudec.h file it didn't work. In fact, it's not very easy to reuse a function or
> a type defined somewhere in the mplayer sources. So I suggest a way to export cleanly functions
> and types :
> In the file foo.c :
>
> /* System includes */
> #include <stdio.h>
> ..
> /* foo.h include */
> #define FOO_C
> #include "foo.h"
> #undef FOO_C
>
> /* other includes */
> ..
> /* static types and functions */
> ..
> /* code */
>
> In the file foo.h :
>
> #ifndef FOO_H
> #define FOO_H
>
> #ifndef FOO_C
> #define EXTERN_FOO extern
> #else
> #define EXTERN_FOO
> #endif
>
> /* exported types */
> typedef t1 ...
>
> /* exported functions */
> EXTERN_FOO f1( ...);
> EXTERN_FOO f2( ...);
> ..
> #undef EXTERN_FOO
> #endif /* FOO_H */
>
> This way, whoever needs the f1 or f2 function or t1 type just has to include
> foo.h et link with foo.o.
> Well I realise what a work applying this to mplayer would be, but it can
> be made each time a .c file is modified...
> </PRE><divRE>Hope, this will help...</PRE><divRE>Savi.</PRE><divRE>PS: I succeded in compiling subrip. It works fine. I plan to submit the
> modifications of this tool soon.
>
>
> </PRE>
> <div></div></td></tr></table><p style="margin-top:11px;padding-top:3px;background-image: url(http://mail.lycos.co.uk/Images/Mail/_content/dot.gif);background-repeat: repeat-x;background-position: 0px 0px;">Plus simple, plus fiable, plus rapide : découvrez <a href=http://www.caramail.lycos.fr>le nouveau Caramail</a>.
>
> _______________________________________________
> MPlayer-dev-eng mailing list
> MPlayer-dev-eng at mplayerhq.hu
> http://mplayerhq.hu/mailman/listinfo/mplayer-dev-eng
More information about the MPlayer-dev-eng
mailing list