Re: [Vala] Support for exporting a ... Jurgen!!!



Hi:

Several weeks ago matias wrote this mail:

Hello all,

It is posible to add an attibute (like '[Export]') for export a callback function in windows? In linux work fine the callback functions but in window must add this to a callback method:

G_MODULE_EXPORT void callback_example ();

When compiling on Linux, this will have absolutely no effect, but when compiling on Windows, the macro expands to __declspec(dllexport), which marks the symbol as one to be exported, so that it can be called by gmodule.

Please this support because is important (in windows only), Thanks!!!

Matias

I think this is really neccesary to the visual C++ compiler, nor to the mingw compiler, because mingw have default export like gcc in unix. I have here some code could be useful to shared libraries when you import it(use the library) o export it(create the library. define the macro -D VALA_APP_MINE_DLL in compilation time):

#ifndef VALA_APP_MINE_H_INCLUDED
#define VALA_APP_MINE_H_INCLUDED

// define VALA_APP_MINE_DLL when building libgerogreringo
# if defined(_WIN32) && !defined(__GNUC__)
#  ifdef VALA_APP_MINE_DLL
#   define VALA_APP_MINE_DECL _  _declspec(dllexport)
#  else
#   define VALA_APP_MINE_DECL _  _declspec(dllimport)
#  endif
# else // Unix
#  if defined(VALA_APP_MINE_DLL) && defined(HAS_GCC_VISIBILITY)
#   define VALA_APP_MINE_DECL _  _attribute_  _((visibility("default")))
#  else
#   define VALA_APP_MINE_DECL
#  endif
# endif


VALA_APP_MINE_DECL void VALA_APP_MINE( );

#endif // VALA_APP_MINE_H_INCLUDED


Stolen from this book:
http://www.cpp-cookbook.com/



Regards.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]