Discussion:
[Foxgui-users] Foxgui-users Digest, Vol 113, Issue 1
pof
2016-06-14 21:23:13 UTC
Permalink
Dear Jeroen,

I am using MSVC++2010.
Trying to compile 1.7.56, the compiler does not know about the function
_InterlockedExchangePointer(ptr,v).

The error appears in FXAtomic.cpp at line 397:
// Atomically set pointer variable at ptr to v, and return its old contents
FXptr atomicSet(volatile FXptr* ptr,FXptr v){
#if (defined(WIN32) && (_MSC_VER >= 1600))
// return _InterlockedExchangePointer(ptr,v); // Error line

Replacing this line with
return (FXptr)_InterlockedExchange((LONG*)ptr,(LONG)v);
seems to work.
Dose this look correct?

Regards
Pof

Message: 3
Date: Mon, 23 May 2016 21:10:34 -0500
Subject: [Foxgui-users] Development Release 1.7.56
Content-Type: text/plain; charset=US-ASCII
- Removed quoted string length limitation in XML parser.
- Removed comment length limitation in XMP parser.
- Pass all text of processing instruction in one single callback from XML parser.
- XML declaration now only recognized if followed by whitespace.
- Updated Visual Studio 2008 project files to add enable intrinsics flags. This was causing problems compiling FXAtomic file.
- In FXAtomic, favor inlined x86 or x86-64 assembly over GCC builtins, due to spotty implementation of these primitives.
- Quoted string in XML could have newlines or blanks; adjusted parsing routine to not lose track of line and column
numbers while parsing over strings.
Enjoy!
-- JVZ
JVZ
2016-06-14 22:48:28 UTC
Permalink
On Tue, 14 Jun 2016 23:23:13 +0200
Post by pof
Dear Jeroen,
I am using MSVC++2010.
Trying to compile 1.7.56, the compiler does not know about the function
_InterlockedExchangePointer(ptr,v).
// Atomically set pointer variable at ptr to v, and return its old contents
FXptr atomicSet(volatile FXptr* ptr,FXptr v){
#if (defined(WIN32) && (_MSC_VER >= 1600))
// return _InterlockedExchangePointer(ptr,v); // Error line
Replacing this line with
return (FXptr)_InterlockedExchange((LONG*)ptr,(LONG)v);
seems to work.
Dose this look correct?
I believe it should be a matter of setting the compiler flag in VC++ to allow
intrinsics [its an intrinsic, not a function call, though it looks like a function
call].

The flag in question should have been turned on now in FOX VC++ project files, at
least, in the snapshot.

The 1.7.56 does not have the flag yet, so just turn it on in the VC++ compile-flags
panel.

Sorry for the inconvience,



-- JVZ


P.S.

The change should speed up atomics by inlining the "magic" instructions into
FXAtomics.cpp instead of calling a C runtime function. This puts Windows on
a par with the Linux version which for the most part uses inlined assembly
or GCC intrinsics.
pof
2016-06-15 21:38:18 UTC
Permalink
Jeroen,

I have checked with the snapshot...
Jus to mention no additional flag seems activated in the snapshot (in
the preprocessor definition), and the compilation fails at the same
location.

Cheers
Pof
PS: this is an intrinsinc, I got the point, thanks
Post by JVZ
On Tue, 14 Jun 2016 23:23:13 +0200
Post by pof
Dear Jeroen,
I am using MSVC++2010.
Trying to compile 1.7.56, the compiler does not know about the function
_InterlockedExchangePointer(ptr,v).
// Atomically set pointer variable at ptr to v, and return its old contents
FXptr atomicSet(volatile FXptr* ptr,FXptr v){
#if (defined(WIN32) && (_MSC_VER >= 1600))
// return _InterlockedExchangePointer(ptr,v); // Error line
Replacing this line with
return (FXptr)_InterlockedExchange((LONG*)ptr,(LONG)v);
seems to work.
Dose this look correct?
I believe it should be a matter of setting the compiler flag in VC++ to allow
intrinsics [its an intrinsic, not a function call, though it looks like a function
call].
The flag in question should have been turned on now in FOX VC++ project files, at
least, in the snapshot.
The 1.7.56 does not have the flag yet, so just turn it on in the VC++ compile-flags
panel.
Sorry for the inconvience,
-- JVZ
P.S.
The change should speed up atomics by inlining the "magic" instructions into
FXAtomics.cpp instead of calling a C runtime function. This puts Windows on
a par with the Linux version which for the most part uses inlined assembly
or GCC intrinsics.
JVZ
2016-06-17 04:23:50 UTC
Permalink
On Thu, 16 Jun 2016 22:56:56 +0200
Post by pof
On Wed, 15 Jun 2016 23:38:18 +0200
Post by pof
Jeroen,
I have checked with the snapshot...
Jus to mention no additional flag seems activated in the snapshot (in
the preprocessor definition), and the compilation fails at the same
location.
I just tried VC++ 2008 build. Flag is (I think) /Oi.
In my VC++2008 I have this on all projects/configurations; no problems.
-- JVZ
Dear Jeroen,
I have checked and the flag /Oi was already active in 1.7.56.
I tried to compile the snapshot, and again I obtain the same error about
_InterlockedExchangePointer(ptr,v).
Just to be sure nothing was wrong from my side I downloaded VC14 and
tried with to compile 1.7.56, with success.
So, it looks like something is wrong with VC++10.
From https://msdn.microsoft.com/en-us/library/853x471w(v=vs.100).aspx,
at the page end a comment tells this is apparently the case.
So wonder if _MSC_VER >= 1600 should not be replaced by _MSC_VER >=
FXptr atomicSet(volatile FXptr* ptr,FXptr v){
#if (defined(WIN32) && (_MSC_VER >= 1700))
return _InterlockedExchangePointer(ptr,v);
Pof
OK, I changed it to 1700. Hopefully this fixes it for you.


-- JVZ
Pof
2016-06-17 05:45:10 UTC
Permalink
Yes this fixes my problem with VC++2010.
Thanks for that
Pof
Post by JVZ
On Thu, 16 Jun 2016 22:56:56 +0200
Post by pof
On Wed, 15 Jun 2016 23:38:18 +0200
Post by pof
Jeroen,
I have checked with the snapshot...
Jus to mention no additional flag seems activated in the snapshot (in
the preprocessor definition), and the compilation fails at the same
location.
I just tried VC++ 2008 build. Flag is (I think) /Oi.
In my VC++2008 I have this on all projects/configurations; no problems.
-- JVZ
Dear Jeroen,
I have checked and the flag /Oi was already active in 1.7.56.
I tried to compile the snapshot, and again I obtain the same error about
_InterlockedExchangePointer(ptr,v).
Just to be sure nothing was wrong from my side I downloaded VC14 and
tried with to compile 1.7.56, with success.
So, it looks like something is wrong with VC++10.
From https://msdn.microsoft.com/en-us/library/853x471w(v=vs.100).aspx,
at the page end a comment tells this is apparently the case.
So wonder if _MSC_VER >= 1600 should not be replaced by _MSC_VER >=
FXptr atomicSet(volatile FXptr* ptr,FXptr v){
#if (defined(WIN32) && (_MSC_VER >= 1700))
return _InterlockedExchangePointer(ptr,v);
Pof
OK, I changed it to 1700. Hopefully this fixes it for you.
-- JVZ
Loading...