From: Dennis S. <sy...@yo...> - 2005-02-14 19:43:44
|
Heya reading the mingw docs, I keep across this: http://mingw.sourceforge.net/docs.shtml Here's an example. Cut and paste the following into a file named dllfct.h: #ifdef BUILD_DLL // the dll exports #define EXPORT __declspec(dllexport) #else // the exe imports #define EXPORT __declspec(dllimport) #endif // function to be imported/exported EXPORT void tstfunc (void); Cut and paste the following into a file named dllfct.c: #include <stdio.h> #include "dllfct.h" EXPORT void tstfunc (void) { printf ("Hello\n"); } This makes me nearly sick :), is there a way to get around this ?, because this would be a complete disaster within libvisual :) |
From: Duilio J. P. <dp...@fc...> - 2005-02-14 20:35:30
|
Why this will be a disaster? EXPORT is defined by mingw? If it is not, you just must define EXPORT to the corresponding thing when building on mingw, or define to empty when not. Bye, Duilio. > Heya reading the mingw docs, I keep across this: > > http://mingw.sourceforge.net/docs.shtml > > > Here's an example. Cut and paste the following into a file named > dllfct.h: > > #ifdef BUILD_DLL > // the dll exports > #define EXPORT __declspec(dllexport) > #else > // the exe imports > #define EXPORT __declspec(dllimport) > #endif > > // function to be imported/exported > EXPORT void tstfunc (void); > > > Cut and paste the following into a file named dllfct.c: > > #include <stdio.h> > #include "dllfct.h" > > EXPORT void tstfunc (void) > { > printf ("Hello\n"); > } > > > > > > This makes me nearly sick :), is there a way to get around this ?, because > this would be a complete disaster within libvisual :) |
From: Dennis S. <sy...@yo...> - 2005-02-14 20:41:29
|
On Mon, 2005-02-14 at 17:27 -0500, Duilio J. Protti wrote: > Why this will be a disaster? EXPORT is defined by mingw? > If it is not, you just must define EXPORT to the corresponding thing > when building on mingw, or define to empty when not. And put it in front of every symbol you export, IE every >EVERY< function. so we get: EXPORT VisActor *visual_actor_new (char *name); and this for every call. Or do I get something wrongly ? |
From: Vitaly V. B. <vit...@uk...> - 2005-02-14 21:55:56
|
On Mon, 14 Feb 2005 21:41:24 +0100 Dennis Smit <sy...@yo...> wrote: > And put it in front of every symbol you export, IE every >EVERY< > function. Well, it is a common practice... I believe it not a mandatory. I've built dll library and a import library. Looks like every thing's fine. [vitalyb@vb .libs]$ i386-pc-mingw32-objdump -x libvisual-0.dll ..... [Ordinal/Name Pointer] Table [ 0] __lv_initialized [ 1] __lv_paramcontainer [ 2] __lv_plugins [ 3] __lv_plugins_actor [ 4] __lv_plugins_input [ 5] __lv_plugins_morph [ 6] __lv_plugins_transform [ 7] __lv_plugpath_cnt [ 8] __lv_plugpaths [ 9] __lv_progname [ 10] __lv_userinterface [ 11] _lv_blit_overlay_alpha32_mmx [ 12] _lv_log [ 13] _lv_scale_bilinear_32_mmx [ 14] visual_actor_get_list [ 15] visual_actor_get_next_by_name [ 16] visual_actor_get_next_by_name_gl .... [ 371] visual_video_set_palette [ 372] visual_video_set_pitch [ 373] win32_sig_handler_sse@4 .... Every non-static symbol was exported. As by default is. ============ test.c int main() { return visual_actor_get_list(); } ============ [vitalyb@vb .libs]$ i386-pc-mingw32-gcc test.c -L. -lvisual.dll [vitalyb@vb .libs]$ i386-pc-mingw32-objdump -x a.exe .... The Import Tables (interpreted .idata section contents) vma: Hint Time Forward DLL First Table Stamp Chain Name Thunk 00004000 00004054 00000000 00000000 000041bc 000040a0 DLL Name: libvisual-0.dll vma: Hint/Ord Member-Name Bound-To 40e8 14 visual_actor_get_list .... So, with GNU tools EXPORT stuff is not necessary. But with non-GNU tools you need these at least within the headers, for successful compilation, I think. Import library can be built from .def (hm, I don't remember exactly) file. -- Vitaly GPG Key ID: F95A23B9 |
From: Duilio J. P. <dp...@fc...> - 2005-02-14 22:22:13
|
> I think. Import library can be built > from .def (hm, I don't remember exactly) file. You are right, using 'autogen' tool. |
From: Dennis S. <sy...@yo...> - 2005-02-14 23:39:47
|
Heya, the win32.dll is building here under windows, I am now diving into the win32 sdk docs to fill up the out defined parts (#if defined(VISUAL_OS_WIN32)) is what I mean :) This is while using the mingw environment btw. I think it would be quite fun to support winamp in the near future! :). We would have a cross operation system audio visualisation platform! how is that :) Cheers, Dennis On Mon, 2005-02-14 at 23:14 +0200, Vitaly V. Bursov wrote: > On Mon, 14 Feb 2005 21:41:24 +0100 > Dennis Smit <sy...@yo...> wrote: > > > And put it in front of every symbol you export, IE every >EVERY< > > function. > Well, it is a common practice... > > I believe it not a mandatory. I've built dll library and a import > library. Looks like every thing's fine. > > [vitalyb@vb .libs]$ i386-pc-mingw32-objdump -x libvisual-0.dll > ..... > [Ordinal/Name Pointer] Table > [ 0] __lv_initialized > [ 1] __lv_paramcontainer > [ 2] __lv_plugins > [ 3] __lv_plugins_actor > [ 4] __lv_plugins_input > [ 5] __lv_plugins_morph > [ 6] __lv_plugins_transform > [ 7] __lv_plugpath_cnt > [ 8] __lv_plugpaths > [ 9] __lv_progname > [ 10] __lv_userinterface > [ 11] _lv_blit_overlay_alpha32_mmx > [ 12] _lv_log > [ 13] _lv_scale_bilinear_32_mmx > [ 14] visual_actor_get_list > [ 15] visual_actor_get_next_by_name > [ 16] visual_actor_get_next_by_name_gl > .... > [ 371] visual_video_set_palette > [ 372] visual_video_set_pitch > [ 373] win32_sig_handler_sse@4 > .... > > Every non-static symbol was exported. As by default is. > > ============ test.c > int main() > { > return visual_actor_get_list(); > } > ============ > > [vitalyb@vb .libs]$ i386-pc-mingw32-gcc test.c -L. -lvisual.dll > [vitalyb@vb .libs]$ i386-pc-mingw32-objdump -x a.exe > .... > The Import Tables (interpreted .idata section contents) > vma: Hint Time Forward DLL First > Table Stamp Chain Name Thunk > 00004000 00004054 00000000 00000000 000041bc 000040a0 > > DLL Name: libvisual-0.dll > vma: Hint/Ord Member-Name Bound-To > 40e8 14 visual_actor_get_list > .... > > So, with GNU tools EXPORT stuff is not necessary. > > But with non-GNU tools you need these at least within the headers, > for successful compilation, I think. Import library can be built > from .def (hm, I don't remember exactly) file. > |