NO

Author Topic: Using MS standard headers on PellesC  (Read 83121 times)

czerny

  • Guest
Re: Using MS standard headers on PellesC
« Reply #45 on: April 04, 2014, 07:15:56 PM »
I have updated the tool with your list.
What tool do you mean?

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: Using MS standard headers on PellesC
« Reply #46 on: April 04, 2014, 07:40:22 PM »
This tool at here
Better to start with copy of PellesC and use -x -xml options.

This tool is for experiment for header fix here

I've messed with various MS headers in the past and this one is one that I hesitate to start (getting old, brain power is decreasing).
Welcome to group ;)
What part are you interested ?
« Last Edit: April 04, 2014, 07:59:40 PM by timovjl »
May the source be with you

CommonTater

  • Guest
Re: Using MS standard headers on PellesC
« Reply #47 on: April 04, 2014, 08:27:41 PM »
Great to see you back Tater.
Long live our forum (upstart) member in his current (but former) incarnation !

Welcome back home.

Thanks, we'll see how long my welcome lasts....

CommonTater

  • Guest
Re: Using MS standard headers on PellesC
« Reply #48 on: April 04, 2014, 08:46:27 PM »
I agree with Tater, to do the job properly is huge task - I've messed with various MS headers in the past and this one is one that I hesitate to start (getting old, brain power is decreasing). Ideally an automated process is needed especially for beginners, plus, as new headers are added the automated process would hopefully deal with the additions.

Absolutely we need to automate the process...
 
We're talking about 1800+ headers.  Granted some will be eliminated as being C++ with no C Interfaces...
But I'm guessing we're still talking about more than 1000 headers.
 
Moreover it is not enough to simply hack the headers. We're going to have to modify/rebuild all the libs too.  We have no idea how many missing imports (linker errors) we will run into if we don't also rework the Libs.
 
What neither Ralph nor Timo seem to appreciate is that over 500 new functions have been added to the API since Win2000 when the current headers were first created. Nobody actually knows how many are not present in the current Pelles C API.
 
By piecing the header set into my test bed in blocks of 10 headers I've already counted more than 15,000 errors and warnings... and ... I'm only half way through the process.  Granted a lot of these are the same error over and over again, but at this point we have no clue either what's causing them or how to fix them.
 
One thing I do know for absolute certain.... disabling compiler warnings is NOT the way to do it.
 
When preparing the original set for Pelles C, Pelle would have had some pretty good idea what the incompatibilities were and how to fix at least most of them.  However; none of this is documented anywhere so we're having to learn this as we go.
 
Take any header for an example.  Compare Pelle's version to the SDK version. In most cases these headers are more than slightly different.  Defines have been changed, the order of things is different, stuff has been added, stuff has been taken out...  It would be enormously helpful to know what and why...  Simple things like "We can't do LPCWCHAR so change it to wchar_t*" would make a huge difference in the depth of the effort.
 
Frankies tool is basically a copier... that isn't even necessary since we can just point our project options at the SDK headers, no matter where they are.   What is needed is a *translator*... Perhaps working from a Rules file telling it what do do in each header.  With that level of automation, it should be possible to do a transformation that works.
 
Then we have the problem of what to do with the Libs...
 

JohnF

  • Guest
Re: Using MS standard headers on PellesC
« Reply #49 on: April 04, 2014, 09:20:45 PM »
timovjl,

>>Welcome to group ;)

:)

>>What part are you interested ?

Are you asking about my old brain? ;)

John

CommonTater

  • Guest
Re: Using MS standard headers on PellesC
« Reply #50 on: April 04, 2014, 11:02:53 PM »
Least i do something to help others ;)

Yep, that was very helpful, thank you.
 
 
 
 

Offline jj2007

  • Member
  • *
  • Posts: 536
Re: Using MS standard headers on PellesC
« Reply #51 on: April 05, 2014, 02:57:56 AM »
SDK Error list to check.

Hi Timo,

Can't help much with this as C is not my area of expertise, but I've sorted your list to highlight the repetitive errors, see attachment.

Apparently Pelles C can't read certain things correctly. Since we can't change the compiler, this implies that Pelles C will need a modified copy of the headers. Some errors seem to occur only when using Pelles C headers in parallel, i.e. that "previously defined" stuff.

Perhaps one could use your file and add, for each error, the error line in the header plus the following line; so that you could see if there is a problem that can be automatically fixed during translation.
« Last Edit: April 05, 2014, 03:00:17 AM by jj2007 »

CommonTater

  • Guest
Re: Using MS standard headers on PellesC
« Reply #52 on: April 05, 2014, 04:20:17 AM »
Just so everyone knows....
 
I am going to be offline for a few days, probably till Tuesday, reconfiguring my systems.
 
I'll rejoin the conversation when I can.
 

JohnF

  • Guest
Re: Using MS standard headers on PellesC
« Reply #53 on: April 05, 2014, 09:32:34 AM »
frankie,

I used your MS-Headers-1.11, it made a backup folder but did not copy the files from the SDK folder to the PellesC folder so I copied them manually.

Your MS-Headers-1.11 compiled ok so I tried my FindFile project. Here are the errors for the file FindFile.c.

====================
Building FindFile.obj.
B:\PellesC\Include\Win\winnt.h(898): warning #2195: Unrecognized intrinsic function: '_rotl8'.
B:\PellesC\Include\Win\winnt.h(899): warning #2195: Unrecognized intrinsic function: '_rotl16'.
B:\PellesC\Include\Win\winnt.h(900): warning #2195: Unrecognized intrinsic function: '_rotr8'.
B:\PellesC\Include\Win\winnt.h(901): warning #2195: Unrecognized intrinsic function: '_rotr16'.
B:\PellesC\Include\Win\winnt.h(2609): warning #2195: Unrecognized intrinsic function: '_InterlockedIncrement16'.
B:\PellesC\Include\Win\winnt.h(2610): warning #2195: Unrecognized intrinsic function: '_InterlockedDecrement16'.
B:\PellesC\Include\Win\winnt.h(2611): warning #2195: Unrecognized intrinsic function: '_InterlockedCompareExchange16'.
B:\PellesC\Include\Win\winnt.h(2612): warning #2195: Unrecognized intrinsic function: '_InterlockedAnd'.
B:\PellesC\Include\Win\winnt.h(2613): warning #2195: Unrecognized intrinsic function: '_InterlockedOr'.
B:\PellesC\Include\Win\winnt.h(2614): warning #2195: Unrecognized intrinsic function: '_InterlockedXor'.
B:\PellesC\Include\Win\winnt.h(2620): warning #2195: Unrecognized intrinsic function: '_InterlockedAnd64'.
B:\PellesC\Include\Win\winnt.h(2621): warning #2195: Unrecognized intrinsic function: '_InterlockedOr64'.
B:\PellesC\Include\Win\winnt.h(2622): warning #2195: Unrecognized intrinsic function: '_InterlockedXor64'.
B:\PellesC\Include\Win\winnt.h(2703): warning #2195: Unrecognized intrinsic function: '_ReadWriteBarrier'.
B:\PellesC\Include\Win\winnt.h(2759): warning #2195: Unrecognized intrinsic function: '__faststorefence'.
B:\PellesC\Include\Win\winnt.h(2765): warning #2195: Unrecognized intrinsic function: '_m_prefetchw'.
B:\PellesC\Include\Win\winnt.h(2811): warning #2195: Unrecognized intrinsic function: '__int2c'.
B:\PellesC\Include\Win\winnt.h(2835): warning #2195: Unrecognized intrinsic function: '__getcallerseflags'.
B:\PellesC\Include\Win\winnt.h(2848): warning #2195: Unrecognized intrinsic function: '__segmentlimit'.
B:\PellesC\Include\Win\winnt.h(2861): warning #2195: Unrecognized intrinsic function: '__readpmc'.
B:\PellesC\Include\Win\winnt.h(2969): warning #2195: Unrecognized intrinsic function: '__mulh'.
B:\PellesC\Include\Win\winnt.h(2970): warning #2195: Unrecognized intrinsic function: '__umulh'.
B:\PellesC\Include\Win\winnt.h(2993): warning #2195: Unrecognized intrinsic function: '__shiftleft128'.
B:\PellesC\Include\Win\winnt.h(2994): warning #2195: Unrecognized intrinsic function: '__shiftright128'.
B:\PellesC\Include\Win\winnt.h(3009): warning #2195: Unrecognized intrinsic function: '_mul128'.
B:\PellesC\Include\Win\winnt.h(3022): warning #2195: Unrecognized intrinsic function: '_umul128'.
B:\PellesC\Include\Win\winbase.h(2208): warning #2195: Unrecognized intrinsic function: '_InterlockedAnd'.
B:\PellesC\Include\Win\winbase.h(2209): warning #2195: Unrecognized intrinsic function: '_InterlockedOr'.
B:\PellesC\Include\Win\winbase.h(2210): warning #2195: Unrecognized intrinsic function: '_InterlockedXor'.
B:\PellesC\Include\Win\winbase.h(2218): warning #2195: Unrecognized intrinsic function: '_InterlockedAnd64'.
B:\PellesC\Include\Win\winbase.h(2219): warning #2195: Unrecognized intrinsic function: '_InterlockedOr64'.
B:\PellesC\Include\Win\winbase.h(2220): warning #2195: Unrecognized intrinsic function: '_InterlockedXor64'.
Done.
==================

Is that what you wanted?

I've only sent the errors for that one file, there are too many errors to include other files from the project.

John


czerny

  • Guest
Re: Using MS standard headers on PellesC
« Reply #54 on: April 05, 2014, 03:44:19 PM »
Hallo!
There are not many active members in this list. And now there is a big disagreement about this MS-header subject. I am afraid that this big different energies sum to zero.

Why not cook a much smaller portion together?

We could start with an first header file and make some experiences. We could continue with some others and will see how to continue further.

There are two other personal considerations:

  • I do not trust automatic conversations in this point.
  • I would rather make the MS-header files Pelles C compatible than making Pelles C able to read the MS-headers.

my two cents, czerny

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: Using MS standard headers on PellesC
« Reply #55 on: April 05, 2014, 04:41:20 PM »
Hallo!
There are not many active members in this list.
Hi Czerny yes you're right that's why I moved the instructions on a locked thread to make easier to look the points out of the mess  ;)
Why not cook a much smaller portion together?
We could start with an first header file and make some experiences. We could continue with some others and will see how to continue further.
Yes this was the approach I propose, maybe my posts were not clear enough  :(
We have to work together nobody can complete this job alone in acceptable times.
I've got a little bit sad that so much energy was waste to discuss ...  :'(
There are two other personal considerations:

  • I do not trust automatic conversations in this point.
  • I would rather make the MS-header files Pelles C compatible than making Pelles C able to read the MS-headers.
my two cents, czerny
Yes we are thinking about this same problem, I have found some problems related to polymorphism of COM headers that lead to multiple functions with the same name. While I have patched them changing in a meaningfull way the name of further occourrencies to automate the process we could not use a simple search and replace (it will locate the code two times unless the search string is very large such to include differentiate code around the patch). Maybe a diff utility could fit better ?  :(
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: Using MS standard headers on PellesC
« Reply #56 on: April 05, 2014, 04:58:28 PM »
frankie,

I used your MS-Headers-1.11, it made a backup folder but did not copy the files from the SDK folder to the PellesC folder so I copied them manually.

Your MS-Headers-1.11 compiled ok so I tried my FindFile project. Here are the errors for the file FindFile.c.
.....
Is that what you wanted?
John

Hi John,
yes thanks I'll take a look at errors.
The tool is a fast and dirty job to try to help novice  ;) I tested it only on an old XP32 that's all hardware I could access moving around, maybe there is aproblem of protection, maybe you can take a look.
The damned problem with headers is that the most simple way to offer them is to patch-zip-post, but because of licensing it is not possible unless we rewrite them ... :P at this point is more usefull to patch the standard PellesC headers with the missing functionalities! (so we give an help also to Pelle  ;) )
Anyway diving ( ;D ) inside headers you'll find that 50% are C++ or nosense, 20% have errors (check on MSDN social), 10% are very specialistics (Native coding, authorization, logon, etc) and the remaining 10% are the headers that we use normally!  >:(
John I'll take a fresh copy of your FindFile from your site, have you any idea on a diff tool, or the like apart from SED or AWK, that could help?
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

czerny

  • Guest
Re: Using MS standard headers on PellesC
« Reply #57 on: April 05, 2014, 05:01:35 PM »
Hallo!
There are not many active members in this list.
Hi Czerny yes you're right that's why I moved the instructions on a locked thread to make easier to look the points out of the mess  ;)
Why not cook a much smaller portion together?
We could start with an first header file and make some experiences. We could continue with some others and will see how to continue further.
Yes this was the approach I propose, maybe my posts were not clear enough  :(
We have to work together nobody can complete this job alone in acceptable times.
I've got a little bit sad that so much energy was waste to discuss ...  :'(
There are two other personal considerations:

  • I do not trust automatic conversations in this point.
  • I would rather make the MS-header files Pelles C compatible than making Pelles C able to read the MS-headers.
my two cents, czerny
Yes we are thinking about this same problem, I have found some problems related to polymorphism of COM headers that lead to multiple functions with the same name. While I have patched them changing in a meaningfull way the name of further occourrencies to automate the process we could not use a simple search and replace (it will locate the code two times unless the search string is very large such to include differentiate code around the patch). Maybe a diff utility could fit better ?  :(

I would like to have two tables of all the (?) header files of Pelles C and MS with the following infos:

  • header file is usable by Pelles C
  • header file is up to date
  • file needs a C++ Compiler
  • header file is a COM interface
  • file is in work by [name]

this tables should be available and editable by all of us.

Secondly, there should be a expandable list of typical errors in the MS files

  • There are no comment signs '//' after endif, per example.

So every helpers can learn from the experiences of others.

And last but not least. The converted header files should be collected in an downloadable zip-file.

I do not know if this forum software is able to help in one of this points?

What about the wiki?

czerny
« Last Edit: April 05, 2014, 05:03:10 PM by czerny »

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: Using MS standard headers on PellesC
« Reply #58 on: April 05, 2014, 05:04:09 PM »
SDK Error list to check.

Hi Timo,

Can't help much with this as C is not my area of expertise, but I've sorted your list to highlight the repetitive errors, see attachment.

Apparently Pelles C can't read certain things correctly. Since we can't change the compiler, this implies that Pelles C will need a modified copy of the headers. Some errors seem to occur only when using Pelles C headers in parallel, i.e. that "previously defined" stuff.

Perhaps one could use your file and add, for each error, the error line in the header plus the following line; so that you could see if there is a problem that can be automatically fixed during translation.
Hi JJ,
thanks for help, this is really usefull as reference on line numbers if we patch by line number  :D
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: Using MS standard headers on PellesC
« Reply #59 on: April 05, 2014, 05:12:30 PM »
WinMerge is a good tool for comparing files / dirs.

John's error list comes from 64-bit version.
I put to PellesC ctype.h this below
Code: [Select]
#ifdef _MSC_EXTENSIONS
/* for compiling with windows.h -- see Microsoft ctype.h */
#ifdef _WIN64
#pragma warn(disable: 2195)
#endif
change is not in that FixHdrLst here
« Last Edit: April 05, 2014, 05:18:38 PM by timovjl »
May the source be with you