Jump to content
Sign in to follow this  
Guest

Sdk.h buggy ?

Recommended Posts

Guest

Has anyone ever compiled a .dll using sdk.h ? It seem that this header doesn't respond to Ansi rules, and has been set for Microsoft Visual C. In MPW as in Codewarrior, I have many errrors and am suspecting that the "int" treatment differs from Apple rules, so the instruments reading will be buggy. Very, very difficult to port to Mac the dlls code source which are also using Microsoft products.

Share this post


Link to post
Share on other sites
Guest

Hi Jean,I've successfully compiled dlls for both the PC and the Mac.Are you able to compile them at all?Matthew.

Share this post


Link to post
Share on other sites
Guest

I had many errors. I noticed that two pragmas not authorized with MPW/Code Warrior were present in sdk.h and I replaced them. There is also a very bad bug : for the Macs "int" has to be on 32 bits. But for the PC, not. So, it's the origin of bad instruments indications I got on some planes. To have good calculations, I came to the conclusion that the all sdk.h has to be corriged !Now, I'm on the source of the dlls released by Chris Wallace and the Rotw : MPW and Code Warrior send me an huge variety of errors when I want compile them. Ough !!!!What compiler do you use ?

Share this post


Link to post
Share on other sites
Guest

Jean,On the PC under VC++, we always have 'int always 32-bit'. CW is probably trying to be smart and cram these into single or double byte storage. And yes, we do NOT follow strict ANSI rules.Rich

Share this post


Link to post
Share on other sites
Guest

Thanks for all, Rich ! Alas, the rules for C++ on Mac are very straightly based on ANSI rules and the PC 32 bits "int" doesn't coincide with the Mac 32 bits "int", because the compilers are based on real memory alignment. So, a PC 32 bits "int " translate in Mac 8, 16 or 32 bits due to his position in the compiled sdk ! We have to attach "int" to a constraining definition, "int32", "int8", etc. The same apply on all C++ structures.On another subject, I am using Cinema4d (which exists also for PC) to make my ATR42-500 for ROTW. So if I had a plug-in to export directly - as in 3dstudio or 3dstudioMax - for FlyII, it would be fine. Can I have the source code of the plug-in to use it with the Cinema4d sdk ? 3dstudioMax has no equivalent in Mac environment and does'nt run very well in Virtual Pc.

Share this post


Link to post
Share on other sites
Guest

Jean,I can see why there might be a packing problem (there is no #pragma pack in the sdk.h file), but I still don't see how this could be affecting int. By ANSI and ISO rules, "plain ints have the naturalsize suggested by the architecture of the execution environment". For Pentium/Athlon/PowerPC architectures, this should always be 32-bits. If the compiler is trying to be smart and save storage by downsizing to short or char, then the compiler is not following the strict ANSI/ISO standards. Now, since many of our types do include non-aligned arrays or interspersed chars, the PowerPC usually needs these aligned on a 32-bit boundary, so this could be why some struct members seemed chopped or terminated, since any shifting for alignment will mess it up. This is a very real and troubling finding -- while the solution itself is very easy (just placing #pragma pack(0) around our typedefs), it would possibly break all existing compiled .DLL add-ons for the PC. What we probably need to determine is what packing VC++ is using on these structs on the PC, and modify the header for Mac builds only to force alignment to the same packing rules. This should fix the problem.As for source code, I'm confused on what source you are asking for. Since we don't have a Cinema4D plug-in, I have no source showing how to convert from their formats to ours. Rich

Share this post


Link to post
Share on other sites
Guest

Rich, I am very confused to take your precious time ! But there WAS pragma in the sdk.h which I have replaced. So the code is now :typedef struct SPythonMethod { char *name; void *method; int flags; char *doc; } SPythonMethod; #pragma options align = packed typedef struct SEpicEvent { unsigned char next; // idle link list unsigned char cmd; // EPIC command unsigned char data[6]; } SEpicEvent; #pragma options align = resetFor the plugin source code I was asking, it's the source code of the plugin for 3dsMax or Truespace, which is not usable as is, but can give me a good starting base to make one for Cinema4d, a very good software which as all the capabilities of 3dstudioMax but is more easy to use and is Mac/PC compatible.Thanks for all the joy you (and the TRI team) give to us.

Share this post


Link to post
Share on other sites
Guest

Jean,Ah, I see. Ok, your change to the pragma is correct. The pragma pack(0) is a VC++ specific pragma, so obviously Rob had never compiled anything with sdk.h or he should have caught that. That struct definitely needs to be packed, since all two of the three members fall on unaligned boundaries.As for the source code, I'll see what I can do about getting permission to give you code for our Max plug-in. If not, you may want to send Chris Wallace a private message here on AVSIM. He wrote the Truespace converter, and probably would be willing to give you some pointers.Rich

Share this post


Link to post
Share on other sites
Guest

Many thanks Rich. As soon the sdk.h will be "sane", I will send you the file. Good health and take some rest, for we prefer wait ing the Mac update and have you "on your feets".

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...