Closed Bug 12913 Opened 20 years ago Closed 20 years ago

NSPR does not support __declspec(dllimport)

Categories

(NSPR :: NSPR, defect, P3)

x86
Windows NT
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jband_mozilla, Assigned: srinivas)

References

Details

Attachments

(1 file)

In Windows calls to exported functions in one dll from another dll are more
efficient if the calling module has been clued into the cross dll calling
sequence by a __declspec(dllimport) declaration. (There may be analogs for other
platforms?)

NSPR should make it easier to do something like the below. And NSPR should
follow this same kind of pattern for its own exports to make using NSPR more
efficient.

/*
 * The linkage of XPTI API functions differs depending on whether the file is
 * used within the XPTI library or not.  Any source file within the XPTI
 * library should define EXPORT_XPTI_API whereas any client of the library
 * should not.
 */
#ifdef EXPORT_XPTI_API
#define XPTI_PUBLIC_API(t)    PR_IMPLEMENT(t)
#define XPTI_PUBLIC_DATA(t)   PR_IMPLEMENT_DATA(t)
#ifdef _WIN32
#    define XPTI_EXPORT           _declspec(dllexport)
#else
#    define XPTI_EXPORT
#endif
#else
#ifdef _WIN32
#    define XPTI_PUBLIC_API(t)    _declspec(dllimport) t
#    define XPTI_PUBLIC_DATA(t)   _declspec(dllimport) t
#    define XPTI_EXPORT           _declspec(dllimport)
#else
#    define XPTI_PUBLIC_API(t)    PR_IMPLEMENT(t)
#    define XPTI_PUBLIC_DATA(t)   t
#    define XPTI_EXPORT
#endif
#endif
Status: NEW → ASSIGNED
*** Bug 12918 has been marked as a duplicate of this bug. ***
Added kent@watsen.net (who created the duplicate
bug #12918) to the cc list.
The NSPR header files will be modified to declare the NSPR functions with the
import attribute for NSPR clients.

I will make the following modifications:

- define PR_EXPORT, PR_EXPORT_DATA, PR_IMPORT, PR_IMPORT_DATA
- declare NSPR functions with the NSPR_API modifier, rather than PR_EXTERN

NSPR_API is defined in prtypes.h

#if defined(_NSPR_BUILD_)
#define NSPR_API(__type) PR_EXPORT(__type)
#define NSPR_DATA_API(__type) PR_EXPORT_DATA(__type)
#else
#define NSPR_API(__type) PR_IMPORT(__type)
#define NSPR_DATA_API(__type) PR_IMPORT_DATA(__type)
#endif

PR_EXTERN will not be modified to avoid breaking backward compatibility. The
diff output for prtypes.h is attached.
The NSPR APIs are now declared with the NSPR_API qualifier.

Files modified:

/cvsroot/mozilla/nsprpub/pr/include/pratom.h,v  <--  pratom.h
new revision: 3.5; previous revision: 3.4
/cvsroot/mozilla/nsprpub/pr/include/prbit.h,v  <--  prbit.h
new revision: 3.5; previous revision: 3.4
/cvsroot/mozilla/nsprpub/pr/include/prcmon.h,v  <--  prcmon.h
new revision: 3.4; previous revision: 3.3
/cvsroot/mozilla/nsprpub/pr/include/prcountr.h,v  <--  prcountr.h
new revision: 3.3; previous revision: 3.2
/cvsroot/mozilla/nsprpub/pr/include/prcvar.h,v  <--  prcvar.h
new revision: 3.3; previous revision: 3.2
/cvsroot/mozilla/nsprpub/pr/include/prdtoa.h,v  <--  prdtoa.h
new revision: 3.5; previous revision: 3.4
/cvsroot/mozilla/nsprpub/pr/include/prenv.h,v  <--  prenv.h
new revision: 3.4; previous revision: 3.3
/cvsroot/mozilla/nsprpub/pr/include/prerror.h,v  <--  prerror.h
new revision: 3.9; previous revision: 3.8
/cvsroot/mozilla/nsprpub/pr/include/prinit.h,v  <--  prinit.h
new revision: 3.9; previous revision: 3.8
/cvsroot/mozilla/nsprpub/pr/include/prinrval.h,v  <--  prinrval.h
new revision: 3.3; previous revision: 3.2
/cvsroot/mozilla/nsprpub/pr/include/prio.h,v  <--  prio.h
new revision: 3.19; previous revision: 3.18
/cvsroot/mozilla/nsprpub/pr/include/pripcsem.h,v  <--  pripcsem.h
new revision: 3.2; previous revision: 3.1
/cvsroot/mozilla/nsprpub/pr/include/prlink.h,v  <--  prlink.h
new revision: 3.5; previous revision: 3.4
/cvsroot/mozilla/nsprpub/pr/include/prlink_mac.h,v  <--  prlink_mac.h
new revision: 1.3; previous revision: 1.2
/cvsroot/mozilla/nsprpub/pr/include/prlock.h,v  <--  prlock.h
new revision: 3.5; previous revision: 3.4
/cvsroot/mozilla/nsprpub/pr/include/prlog.h,v  <--  prlog.h
new revision: 3.8; previous revision: 3.7
/cvsroot/mozilla/nsprpub/pr/include/prlong.h,v  <--  prlong.h
new revision: 3.5; previous revision: 3.4
/cvsroot/mozilla/nsprpub/pr/include/prmem.h,v  <--  prmem.h
new revision: 3.6; previous revision: 3.5
/cvsroot/mozilla/nsprpub/pr/include/prmon.h,v  <--  prmon.h
new revision: 3.3; previous revision: 3.2
/cvsroot/mozilla/nsprpub/pr/include/prmwait.h,v  <--  prmwait.h
new revision: 3.5; previous revision: 3.4
/cvsroot/mozilla/nsprpub/pr/include/prnetdb.h,v  <--  prnetdb.h
new revision: 3.4; previous revision: 3.3
/cvsroot/mozilla/nsprpub/pr/include/prolock.h,v  <--  prolock.h
new revision: 3.3; previous revision: 3.2
/cvsroot/mozilla/nsprpub/pr/include/prpdce.h,v  <--  prpdce.h
new revision: 3.4; previous revision: 3.3
/cvsroot/mozilla/nsprpub/pr/include/prprf.h,v  <--  prprf.h
new revision: 3.3; previous revision: 3.2
/cvsroot/mozilla/nsprpub/pr/include/prproces.h,v  <--  prproces.h
new revision: 3.6; previous revision: 3.5
/cvsroot/mozilla/nsprpub/pr/include/prrng.h,v  <--  prrng.h
new revision: 1.2; previous revision: 1.1
/cvsroot/mozilla/nsprpub/pr/include/prrwlock.h,v  <--  prrwlock.h
new revision: 1.4; previous revision: 1.3
/cvsroot/mozilla/nsprpub/pr/include/prshm.h,v  <--  prshm.h
new revision: 3.2; previous revision: 3.1
/cvsroot/mozilla/nsprpub/pr/include/prshma.h,v  <--  prshma.h
new revision: 3.2; previous revision: 3.1
/cvsroot/mozilla/nsprpub/pr/include/prsystem.h,v  <--  prsystem.h
new revision: 3.4; previous revision: 3.3
/cvsroot/mozilla/nsprpub/pr/include/prthread.h,v  <--  prthread.h
new revision: 3.6; previous revision: 3.5
/cvsroot/mozilla/nsprpub/pr/include/prtime.h,v  <--  prtime.h
new revision: 3.5; previous revision: 3.4
/cvsroot/mozilla/nsprpub/pr/include/prtrace.h,v  <--  prtrace.h
new revision: 3.3; previous revision: 3.2
/cvsroot/mozilla/nsprpub/pr/include/prtypes.h,v  <--  prtypes.h
new revision: 3.14; previous revision: 3.13
/cvsroot/mozilla/nsprpub/pr/include/prvrsion.h,v  <--  prvrsion.h
new revision: 3.3; previous revision: 3.2
/cvsroot/mozilla/nsprpub/pr/include/prwin16.h,v  <--  prwin16.h
new revision: 3.4; previous revision: 3.3
/cvsroot/mozilla/nsprpub/pr/include/md/_beos.h,v  <--  _beos.h
new revision: 3.9; previous revision: 3.8
/cvsroot/mozilla/nsprpub/pr/include/md/_irix.h,v  <--  _irix.h
new revision: 3.7; previous revision: 3.6
/cvsroot/mozilla/nsprpub/pr/include/md/_macos.h,v  <--  _macos.h
new revision: 3.18; previous revision: 3.17
/cvsroot/mozilla/nsprpub/pr/include/md/_nspr_pthread.h,v  <--  _nspr_pthread.h
new revision: 3.5; previous revision: 3.4
/cvsroot/mozilla/nsprpub/pr/include/md/_openvms.h,v  <--  _openvms.h
new revision: 1.7; previous revision: 1.6
/cvsroot/mozilla/nsprpub/pr/include/md/_os2.h,v  <--  _os2.h
new revision: 3.11; previous revision: 3.10
/cvsroot/mozilla/nsprpub/pr/include/md/_os2_errors.h,v  <--  _os2_errors.h
new revision: 3.5; previous revision: 3.4
/cvsroot/mozilla/nsprpub/pr/include/md/_solaris.h,v  <--  _solaris.h
new revision: 3.10; previous revision: 3.9
/cvsroot/mozilla/nsprpub/pr/include/md/_unix_errors.h,v  <--  _unix_errors.h
new revision: 3.6; previous revision: 3.5
/cvsroot/mozilla/nsprpub/pr/include/md/_win16.h,v  <--  _win16.h
new revision: 3.9; previous revision: 3.8
/cvsroot/mozilla/nsprpub/pr/include/obsolete/pralarm.h,v  <--  pralarm.h
new revision: 3.4; previous revision: 3.3
/cvsroot/mozilla/nsprpub/pr/include/obsolete/probslet.h,v  <--  probslet.h
new revision: 3.5; previous revision: 3.4
/cvsroot/mozilla/nsprpub/pr/include/obsolete/prsem.h,v  <--  prsem.h
new revision: 3.3; previous revision: 3.2
/cvsroot/mozilla/nsprpub/pr/include/private/pprio.h,v  <--  pprio.h
new revision: 3.8; previous revision: 3.7
/cvsroot/mozilla/nsprpub/pr/include/private/pprthred.h,v  <--  pprthred.h
new revision: 3.5; previous revision: 3.4
/cvsroot/mozilla/nsprpub/pr/include/private/primpl.h,v  <--  primpl.h
new revision: 3.32; previous revision: 3.31
Is sounds like this got fixed. Is there some reason this bug get not get marked 
as FIXED?
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.