Fwd: FW: [sv-cc] using _MSC_VER in svdpi.h

From: Daniel Mlynek <danielm@aldec.com.pl>
Date: Wed Oct 26 2011 - 22:05:23 PDT

Just forwarding Oleg's e-mail

------------------------------------------------------------------------
*From:* Oleg Demchenko [mailto:olegd@aldec.com.pl]
*Sent:* Wednesday, October 26, 2011 2:30 PM
*To:* 'Bresticker, Shalom'
*Subject:* RE: [sv-cc] using _MSC_VER in svdpi.h

Hello,
Just to introduce myself I am developer in Aldec working on DPI support.
I have read thread http://www.eda.org/sv-cc/hm/4485.html and if I've
understood it correctly:
1. WIN32 was discarded since there is no such macro on MSVC (only _WIN32
is available)
2. _WIN32 wasn't used either because __declspec(dllexport) is Microsoft
specific attribute thus _MSC_VER was used
I understand point #1, but have some doubts about point #2.
In one way or ther other, but __declspec(dllimport/dllexport) is
respected by several gcc windows ports, for example here
http://gcc.gnu.org/onlinedocs/gcc-3.3.6/gcc/Function-Attributes.html we
read:
/"5.25 Declaring Attributes of Functions/
/...
On cygwin, mingw and arm-pe targets, __declspec(dllimport) is recognized
as a synonym for __attribute__ ((dllimport)) for compatibility with
other Windows compilers. /
/...
On cygwin, mingw and arm-pe targets, __declspec(dllexport) is recognized
as a synonym for __attribute__ ((dllexport)) for compatibility with
other Windows compilers."
/
In my opinion using _MSC_VER in deciding how to define
DPI_DLLISPEC/DPI_DLLESPEC is too restictive. It will cause difficulties
for users using MinGW (since as far as I know MinGW doesn't define
_MSC_VER) to compile thier DPI code.
Maybe a better option would be _WIN32, since it is present on MSVC and
MinGW. If for some reason this deemed too permissible then maybe another
option would be to extend list of compilers to those which have
indicated support __declspec(dllimport/dllexport) attributes e.g.:
#if (defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__)
#define DPI_DLLESPEC __declspec(dllexport)
#else
#define DPI_DLLESPEC
#endif
etc.
Best regards,
Oleg

------------------------------------------------------------------------
*From:* Bresticker, Shalom [mailto:shalom.bresticker@intel.com]
*Sent:* Wednesday, October 26, 2011 12:32 PM
*To:* Daniel Mlynek; sv-cc@eda.org; Oleg Demchenko; Radoslaw Nawrot
*Subject:* RE: [sv-cc] using _MSC_VER in svdpi.h

In Mantis 3022, they changed from WIN32 to _/MSC/_VER.

See http://www.eda.org/sv-cc/hm/4485.html.

Shalom

*From:*owner-sv-cc@eda.org [mailto:owner-sv-cc@eda.org] *On Behalf Of
*Daniel Mlynek
*Sent:* Wednesday, October 26, 2011 10:05 AM
*To:* sv-cc@eda.org; Oleg Demchenko; Radoslaw Nawrot
*Subject:* [sv-cc] using _MSC_VER in svdpi.h

In *svdpi.h there is :*

/* Use to export a symbol from application */
#if defined (*_MSC_VER*)
#define DPI_DLLISPEC __declspec(dllimport)
#else
#define DPI_DLLISPEC
#endif

/* Use to import a symbol into application */
#if defined (*_MSC_VER*)
#define DPI_DLLESPEC __declspec(dllexport)
#else
#define DPI_DLLESPEC
#endif

This will cause that when compiling with MinGW on windows (which does
not define _MSC_VER) functions using DPI_DLLISPEC will not be exported
corectly.

For similar purpose in file vpi_user.h WIN32 macro is used instead _MSC_VER.
What is the reason of using _MSC_VER instead WIN32? Maybe WIN32 macro
can/should be used also in svdpi.h?

DANiel

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed Oct 26 22:04:58 2011

This archive was generated by hypermail 2.1.8 : Wed Oct 26 2011 - 22:05:08 PDT