How to share structure with arrays in a single file between C# and C with arrays?

It is possible to define things so that a file that contains a struct definition can be included in both C# and C programs once the differences are taken into account. Most of these differences can be handled but not all. One of those problems is arrays.
Here's a contrived example of a file that can be imported directly into either a C or a C# project. If '__c__' is defined then the file is being imported into a C++ project. If not then the file is being consumed by a C# project. This simple little
thing allows those things that are different between the two environments to be taken into consideration. The one really knotty problem is how to handle arrays. In C, an array can be given a fixed size in a struct. Not so in C#. C# generates a compile time
error. I've been working around it so far by numbering the elements in the C# branch.
// If '__c__' is defined then the file is being included in a C project.
// If not then the file is being included in a C# project.
#if !__c__
// C# can utilize a namespace. C cannot.
namespace CrossPlatform
// C# wants to include the struct in a class.
public class Structs
#endif
#if __c__
// C defines a struct as a named typedef.
typedef struct _RtInfo
#else
// C# wants a struct object with a name.
public struct RtInfo
#endif
// Simple value types and previously defined structures
// can be shared directly between both C and C#.
float f;
#if __c__
// Arrays cannot be shared. C can use arrays with a size.
int v[4];
#else
// but C# cannot deal with sized arrays at all.
int v0;
int v1;
int v2;
int v3;
#endif
#if __c__
// C optionally gives the struct a name.
} CALDATA;
#else
// C# does not do that here.
#endif
#if !__c__
} // end of class.
} // end of namespace block wrapper.
#endif
Richard Lewis Haggard

Hi
Richard.
Would you mind letting us know the result of the suggestion?
I temporarily mark
Viorel’s last response as an answer. You can unmark
it if they provide no help.
Best regards,
Kristin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • How to share things with aplication express?

    The most important thing for using a database is sharing things, but why I grant even all of one of my table to one user, but she even cannot use it, just say: error; userxxx don't have the right to access the content?
    Very strange, and the Synonm is also no good, I create one for another user's table, like create synonm XXX for username.tablename.
    but when I want to : Select x,x.x, from xxx, it doesn't work!!!
    how to share things with Database?

    Better to give you some photos that can let you see
    the problem , but that can not happen here.Actually, you can use pictures. Do a screen capture where you're having the problem, upload it to http://tinypic.com and then put the link to the picture here in your posting.
    Please be noticed all , me and the users don't know
    much about SQL, I know some. So everything has to be
    done in the GUI interface.Well, the GUI isn't always enough. If you want to do grants you really need to use the SQL command window - and learn the proper syntax for the grant operation.
    I(A) grant select , update, insert on A.xx to user
    B,
    but they see onthing in ther Application Express, how
    can they do insert and all works just like I do ? What is the parsing schema for your application? Is it set to the schema where your data lives?
    Earl

  • How to share Pages with other user accounts

    How to share "Pages"with other user accounts

    When you install it, do it for "Everyone" or in the Admin account.
    Peter

  • HT202213 How to share iTunes with my iphone

    How to share iTunes with my iphone

    iTunes: Syncing media content to iOS devices and iPod - http://support.apple.com/kb/HT1351 - detailed example: https://discussions.apple.com/message/18860187
    iOS: Syncing with iTunes - http://support.apple.com/kb/ht1386 -  You can sync everything or selected playlists.  "WIth iTunes 10, when automatically syncing, you can also manually drag items to the iDevice. These will show up in Manually Added Songs at the bottom of the Music tab after Playlists, Artists Genre, Albums." - https://discussions.apple.com/message/18919754

  • How to share files between pc and mac via external hard drive

    how can i share my files(mp3,mp4,documents) from my harddisk with mac. i am a new mac user and i have a harddisk of NTFS format(as i was a pc user).I learned that mac supports FAT32 format and therefore i can't write data on my external hard drive.
    but, reading a section of OSX yosemite(under compatibility) it is said that now we can easily share files between pc and mac.
    So please suggest me easier way that how can i share files between macs and pc as my friends uses pc and in future i really want to share my data with them without any hustle and i dont wanna loose my data in future

    You can format the HDD to a common one like ExFAT or Fat32 but a reformat will delete all data off of the HDD.
    Your other option is to use a third party software such as Paragon or Tuxera that will allow you to write to a NFTS formatted HDD.
    Ciao.

  • Share files between Mac and Windows in same iMac with boot camp

    Hello,
    I am new in using Mac and recently I buy a IMac 24" model.
    I used to use PC a long time with a lot of old document.
    I want to install Windows XP with boot camp.
    But I also want to share my documents, music, video files between Mac and Windows in same iMac.
    How can I do this?
    Thanks in advance,
    Eric

    Hi Eric and welcome to Discussions and the Apple world.
    Mac OSX can read and write from Windows partitions (like the BootCamp Windows partition you are about to create) when using FAT32 as file system for Windows.
    However with FAT32 you are limited to a partition size of 32GB.
    Mac OSX can also read from Windows partitions that uses the NTFS file system, but it can not write to them unless you use a third-party helper like either Paragons NTFS for Mac http://www.paragon-software.com/home/ntfs-mac/ or NTFS-3G http://www.ntfs-3g.org/
    Windows can not even see or use a Mac OSX partition without additional help by MacDrive http://www.mediafour.com/products/macdrive/
    Regards
    Stefan

  • How do I sync a PDF file between iPhone and iPad in iBooks?

    How do I sync a PDF file between iPhone and iPad in iBooks?

    If the PDF supports it then you can try opening the PDF in iBooks on your phone and use the 'share' icon (the square with the upward pointing arrow) to email it to yourself (some PDFs a protected and don't support emailing) and use 'open in' in the Mail app on your iPad to copy it to its Mail app.
    Or you can connect the phone to your computer's iTunes and do File > Devices > Transfer Purchases to copy it over to your iTunes (that should copy PDFs and/or epubs that are in the iBooks app, not just ibooks) and if using a Mac with Mavericks or Yosemite on it then do File > Move Books From iTunes in its  iBooks app, and you can then sync it to your iPad.

  • Does anyone know if there is a way to share files between Mavericks and Mac OS 9.1 operating system?

    Does anyone know if there is a way to share files between Mavericks and Mac OS 9.1 operating system? When I try to connect from my iMac I get a window that says "The version of the server you are trying to connect to is not supported." Is there a work-around to this problem or is it just not possible? It would be largly appriciated for a solutin beings my business is a small town newspaper, and we have some important files on the older computer that need to be acessed daily.

    Actually to share files between OS 8-9 and OS X, all versions, is quite easy from what I read. Look here for some details.
    http://reviews.cnet.com/8301-13727_7-20003464-263.html
    And here.
    https://www.google.com/search?q=file+sharing+Mac+OS+9.x&oq=file+sharing+Mac+OS+9 .x&aqs=chrome..69i57.20706j0j1&sourceid=chrome&ie=UTF-8
    Or since both OS 9 and OS X can do SMB Windows sharing you could use that protocol to share files from one to the other.
    Doesn't really matter what OS you are using. Mac OS/OS X shar files with Windows computers of all types and versions of Windows so the same applies for the different versions of Mac OS/OS X.
    Each Operating System takes care of reading and writing files to there respective file formats of the hard drives so that does not have to be the same. They both just have to be able to do Ethernet with the same files sharing protocol.

  • How can i scan multiple pages in a single file in pdf.

    How can i scan multiple pages in a single file in pdf using 1536 dnf.

    Hi @veerendrajain ,
    I see that you would like to save multiple PDF documents into one file. I would like to help you out today.
    In the HP Scan Software, select Advanced scan settings, click on the File tab and uncheck Create a separate file for each scanned image.
    Hope this helps.
    Have a nice day!
    Thank You.
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" on the right to say “Thanks” for helping!
    Gemini02
    I work on behalf of HP

  • I am thinking of buying a iPad but my main desktop machine uses Windows 7 and MS Office.  How easy or difficult is it to transfer data files between the iPad and Windows?  Are there obvious problems or the need for some form of conversion programs?

    I am thinking of buying a iPad but my main desktop machine uses Windows 7 and MS Office.  How easy or difficult is it to transfer data files between the iPad and Windows?  Are there obvious problems or the need for some form of conversion programs?
    Many thanks for any advice.
    David

    You don't need conversion programs, iTunes can copy most of your content over to the iPad via the file sharing section, and some apps also support Dropbox, email attachments, transfer via your wifi network. There are a number of apps that you can get that support Microsoft office file (microsoft don't make an app versions of their software) e.g. from Apple there are Pages (word support), Numbers (excel) and Keynote (powerpoint), and from third-parties there are apps such as Documents To Go and QuickOffice HD

  • HT204291 how to transfer files between 5C and ipad

    how to transfer files between 5C and ipad data

    iCloud: http://www.apple.com/icloud/features/
    or using a computer, iTunes: http://support.apple.com/kb/ht1296

  • How do you save a webpage as a single file like internet explorer

    how do you save a webpage as a single file like internet explorer

    *Mozilla Archive Format: https://addons.mozilla.org/firefox/addon/mozilla-archive-format/
    *UnMHT: https://addons.mozilla.org/firefox/addon/unmht/

  • How to share account with multiple devices?

    3 kids with 3 devices - an iPod Touch and two iPads Mini - family shares one account with Apple/iTunes and one library on our family PC.  They use FACETIME and MESSAGES with their friends, and they all see each others messages and conversations.  How do I fix this?  Is there a setting or a way to create sub-accounts off the family account so they can still share the main library for music and video OR do I have to create separate Apple/iTunes accounts for each kid?  Is there a setting on their devices that can help?  Any help is greatly appreciated.  I'm not even sure the right question to ask...

    How to use multiple iPods, iPads, or iPhones with one computer
    http://support.apple.com/kb/HT1495
    How to Share a Family iPad
    http://www.macworld.com/article/1163347/how_to_share_a_family_ipad.html
    Using iPhone, iPad, or iPod with multiple computers
    http://support.apple.com/kb/ht1202
    iOS & iCloud Tips: Sharing an Apple ID With Your Family
    http://www.macstories.net/stories/ios-5-icloud-tips-sharing-an-apple-id-with-you r-family/
    How To Best Use and Share Apple IDs across iPhones, iPads and iPods
    http://www.nerdsonsite.com/blog/2012/06/07/help-im-appleid-confused/
     Cheers, Tom

  • How to share folder with only one person one same Mac

    Could someone please remind me how I share a folder with one person I share my Mac with but not the others (we all have different profiles on the same machine...)
    Thanks,
    Michael

    EddyS45 wrote:
    My wife & I use the same iMac with different user accounts.  How do we share one iTunes account on that computer.  I tried moving the iTunes folder in music on my user account to shared user
    Then hold Option and launch iTunes.
    Select Choose library... and select the iTunes folder in /Users/Shared/ folder.

  • How to share documents with iCloud and Pages?

    I keep getting reminded to remove everything from iWork, but I don't really understand how to share anything (documents) on iCloud. Am I missing something? (Well, I know I am, but it isn't exactly straightforward to me.)
    Could someone point me to some information about that?
    Thanks.

    You can store iWorks docs on iCloud, but you cannot share them with others.  The old iWorks beta web site let you host files for other remote users to have access to them, and iCloud (at least not now) does not allow that.

Maybe you are looking for

  • Can't purchase home network defender after trial. Can anyone help??????

    I get an error page that says:   Due to the instability of your Internet connection, we cannot process your request. Please try again in a few minutes  I talked to 2 live techs and still no help.  The first guy said that I had to buy network magic fo

  • Acrobat 9 - Adding Flash Copntent

    Hello all, just downloaded the Acrobat 9 trial and I wonder: How can I embed complex Flash structures into a PDF-document? Complex means: There is a "main"-swf, that loads other swf-files into different levels. The main-swf reads variables from eg. a

  • NameTrans doesn't work in Sun One 7

    hi, OS Solaris 10 Web: Sun One 7u1 this line in obj.conf doesn't work anymore in Sun Web 7, but worked in 6.xx NameTrans fn="pfx2dir" from="/rabota/css" dir="/opt/semen/secure/rabota-css" name="es-internal" What changes should be applied for Web 7???

  • Multiple timeout sessions

              hi           i have 2 different websites running under the same weblogic instance. is it possible           to have different timeout sessions? and how to make weblogic direct to different           JSP files when it encounters timeout?    

  • Whats the best way to expose this in memory database? (ArrayList)

    Hello everyone. I was looking for advice on how I should implement this...currently I have the following ArrayList that stores ClassEntity objects. I'm going to write 2 classes that need to access this ClassEntity Object arrayList because they are go