Re: Exporting stl class

From: David Webber (dave_at_musical.demon.co.uk)
Date: 05/03/04


Date: Mon, 3 May 2004 17:29:01 +0100


"Boris Sargos" <bsargos@wanadoo.fr> wrote in message
news:c73uk7$l66$1@news-reader4.wanadoo.fr...

>>>=========
Thanks for your answer.
After hours and hours searching on the web, I found some help here :

http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q168/9/58.ASP&NoWebContent=1

and it seems to work with valarray too. I'm not completly sure
because I still have errors with slice_array.
For the warnings, I used the following pragmas:
  a.. #pragma warning (disable : 4786) //disable warnings on 255
char debug symbols
  b.. #pragma warning (disable : 4231) //disable warnings on extern
before template instantiation
  c.. #pragma warning (disable : 4018) // disable warnings on
incompatibiliy signed/unsigned
  d.. #pragma warning (disable : 4251) // disable warnings on std
and dll
Thanks.
=====<<<<<<<<<<<<<<<<<<

For the record here (schematically) is what I have to do in the
header file:

#pragma warning( disable: 4251 ) // VC++7 - was ok in VC++6.
#pragma warning( disable: 4231 ) // MSDN article Q168958 tells me to
ignore this warning.
#include <vector>
#include "myclass.h"

//...

//******************************************************************
**********************
// Exported from DLL:
//******************************************************************
**********************
#ifdef MY_EXPORTS
#define MY_API __declspec(dllexport)
#define EXTERN_MY_API
#else
#define MY_API __declspec(dllimport)
#define EXTERN_MY_API extern
#endif

//
********************************************************************
******************
// Instantiate a vector:
// This is necessary if the class derived from vector is to be
exported.
//
********************************************************************
******************

EXTERN_MY_API template class MY_API std::vector<CMyClass>;

//******************************************************************
*********************
// class CMyArray
//******************************************************************
*********************

class MY_API CMyArray : public std::vector<CMyClass>
{
    //................
};

Dave

-- 
David Webber
Author MOZART the music processor for Windows -
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mzusers/mailinglist.htm


Relevant Pages

  • Re: Access runtime 2003 with Common Dialog DLL
    ... > that do and those that do not generate warnings is not clear. ... My MDE runs without warnings on machines that include ... > XP Pro and on machines that do not have any version of Office on them. ... My attempts to register the DLL using ...
    (microsoft.public.access.setupconfig)
  • Re: Access runtime 2003 with Common Dialog DLL
    ... DLL have always worked well for me in the past, ... The application installs without error and runs ... >> that do and those that do not generate warnings is not clear. ... >> XP Pro and on machines that do not have any version of Office on them. ...
    (microsoft.public.access.setupconfig)
  • Re: After each new dll compilation I have to set the reference to the dll in Excel again.
    ... > receive several warnings during compilation stating these ... Ignore the warnings and compile the dll. ... Remember that from now on you have a contract with your project: ...
    (microsoft.public.excel.programming)
  • Getting rid of STL warnings during compile
    ... The sample code is shown below: ... Here is a sample of the warnings being generated: ... char>>,unsigned ... reference to class template instantiation ...
    (microsoft.public.vc.stl)