-
Mar 12th, 2015, 10:33 AM
#1
Thread Starter
Addicted Member
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
-
Mar 12th, 2015, 06:17 PM
#2
Re: C++ to VB.NET conversion.
I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
My war with a browser-redirect trojan
-
Mar 13th, 2015, 03:07 AM
#3
Thread Starter
Addicted Member
Re: C++ to VB.NET conversion.
Thanks Mr.Dolot. But the solution provided by converter is not working.
Regards,
Susheelss
Originally Posted by dolot
-
Mar 13th, 2015, 09:04 AM
#4
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.
-
Mar 13th, 2015, 01:45 PM
#5
Re: C++ to VB.NET conversion.
Originally Posted by dolot
I doubt those things actually work. I always thought they were just scams.
-
Mar 13th, 2015, 03:40 PM
#6
Re: C++ to VB.NET conversion.
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.
"Ok, my response to that is pending a Google search" - Bucky Katt.
"There are two types of people in the world: Those who can extrapolate from incomplete data sets." - Unk.
"Before you can 'think outside the box' you need to understand where the box is."
-
Mar 13th, 2015, 04:08 PM
#7
Re: C++ to VB.NET conversion.
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.
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.
-
Mar 13th, 2015, 04:23 PM
#8
Re: C++ to VB.NET conversion.
Originally Posted by Toph
I still doubt it.
Look.
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.
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.
-
Mar 13th, 2015, 05:23 PM
#9
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.
My usual boring signature: Nothing
-
Mar 13th, 2015, 06:08 PM
#10
Re: C++ to VB.NET conversion.
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.
-
Mar 13th, 2015, 09:16 PM
#11
Re: C++ to VB.NET conversion.
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).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|