C++ to VB.NET conversion.
Hi All,
I am trying to interface a third party DLL to my VB.NET program. I am stuck in converting the following code to VB.NET. Hence it would be very helpful if anybody could post equivalent code in VB.NET for the C++ code posted below:
Code:
typedef struct __attribute__((__packed__)) __tagRAD_CTRL_BITS {
uint16_t tr_bFrameRateIndex :3;
uint16_t tr_bAECExposure :1;
uint16_t tr_bRadExposure :1;
uint16_t tr_bFilamentSelect :3;
uint16_t tr_bFieldSelect :3;
uint16_t tr_bFilmScreen :2;
uint16_t tr_bAECDensity :3;
} TR_RAD_CTRL_BITS, *PTR_RAD_CTRL_BITS;
typedef struct __attribute__((__packed__)) __tagRAD_EXAM_DATA_STR {
uint8_t tr_nkV_Hi_Byte;
uint8_t tr_nkV_Lo_Byte;
uint8_t tr_nmA;
uint8_t tr_nBUT;
uint8_t tr_nBUmAs;
TR_RAD_CTRL_BITS tr_trRadCtrlBits;
uint8_t tr_nRunLength;
} TR_RAD_EXAM_DATA_STR, *PTR_RAD_EXAM_DATA_STR;
typedef union __attribute__((__packed__)) __tagRAD_EXAM_DATA {
TR_RAD_EXAM_DATA_STR u_trRadExamData;
uint8_t u_naRadExamData[8];
} U_RAD_EXAM_DATA, *PU_RAD_EXAM_DATA;
Regards,
Susheelss
Re: C++ to VB.NET conversion.
Re: C++ to VB.NET conversion.
Thanks Mr.Dolot. But the solution provided by converter is not working.
Regards,
Susheelss
Quote:
Originally Posted by
dolot
Re: C++ to VB.NET conversion.
Bit fields (in your first type) are simply not available in VB.
In modern programming there is little need for this.
Re: C++ to VB.NET conversion.
Quote:
Originally Posted by
dolot
I doubt those things actually work. I always thought they were just scams.
Re: C++ to VB.NET conversion.
Quote:
Originally Posted by
Toph
I doubt those things actually work. I always thought they were just scams.
Yes they do work, and not a scam.
There are some online solutions for small snippets of code, you can use Reflector to 'convert' assemblies from one language to another, or you can use a full-blown solution, like this, to perform a conversion for you; this usually accommodates most of the quirks when converting from one language to another.
Re: C++ to VB.NET conversion.
Quote:
Originally Posted by
SJWhiteley
Yes they do work, and not a scam.
There are some online solutions for small snippets of code, you can use Reflector to 'convert' assemblies from one language to another, or you can use a full-blown solution, like this, to perform a conversion for you; this usually accommodates most of the quirks when converting from one language to another.
I still doubt it.
Look.
http://i.imgur.com/yW8MdXF.png
They're charging for VB.NET and C# conversions, when you can do it for free using http://converter.telerik.com/
Tell me that's not a scam.
Re: C++ to VB.NET conversion.
Quote:
Originally Posted by
Toph
Interesting logic. Any software that is sold is a scam if a reduced feature version is freely available? By that reasoning, I guess the paid versions of Visual Studio are a scam because a large percentage of their features are offered in the free Express Editions. Also by that analogy, any professional programmer giving free advise on this forum is a scammer because they may also charge for their services.
Re: C++ to VB.NET conversion.
Those structures are nothing more than a UInt16 and a Byte (UInt8 would be a Byte). The fact that the bits within the UInt16 have some kind of meaning may not be relevant. How are they used? If the dll just needs the arguments, then you might just supply a UInt16 and a Byte.
Re: C++ to VB.NET conversion.
Quote:
Originally Posted by
TnTinMN
Interesting logic. Any software that is sold is a scam if a reduced feature version is freely available? By that reasoning, I guess the paid versions of Visual Studio are a scam because a large percentage of their features are offered in the free Express Editions. Also by that analogy, any professional programmer giving free advise on this forum is a scammer because they may also charge for their services.
LOOOOOL. Nooo, I just mean it looks too good to be true from my perspective. I don't see how you can convert vb.net code to C++ using a program. Wouldn't that be basically AI? Or am I over thinking this.
Re: C++ to VB.NET conversion.
Quote:
Originally Posted by
Toph
LOOOOOL. Nooo, I just mean it looks too good to be true from my perspective. I don't see how you can convert vb.net code to C++ using a program. Wouldn't that be basically AI? Or am I over thinking this.
(Disclaimer: I work for a company which makes converters, including the one mentioned earlier).
You're correct - it can't be done 100%.
However, programming languages have a lot in common regarding syntax - often it looks very different but the underlying intent is the same and the syntax that both languages have in common can be fairly reliably converted to the other language. The syntax that's not common (such as bit fields), well that can be a problem - the converter won't help you there and you'll have to work around those issues yourself.
Converters can eliminate a lot of manual labor - this is what some people find is worth paying for. How much of your time do you have to save to cover the cost of a converter? If the price is too high, most companies (including ours) offer free versions with some limitations (some of our best feedback has come from people who never paid us a dime).