Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 150,131 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 2,138 people online right now. Registration is fast and FREE... Join Now!




c/cpp conversion to vb

 
Reply to this topicStart new topic

c/cpp conversion to vb, Structure statement conversion

woodjom
19 Jul, 2008 - 06:57 PM
Post #1

New D.I.C Head
*

Joined: 8 May, 2008
Posts: 46



Thanked: 1 times
My Contributions
well i am a long time vb/c/cpp code, mostly vb, and was wondering after looking at some c/cpp code how to port this statement to vb.net, with the .net framework.

code example:
CODE
...
typedef void SPELL_FUN args( ( int sn, int level, CHAR_DATA *ch, void *vo,    int target ) );  //declaration
...
SPELL_FUN * spell_fun; //usage
...


as well, i am trying to make a forward pointing structure statement, converted from the c/cpp code but having issues doing the conversion. if i can get this answered with a solution in vb instead of compiling into a DLL and making areference from there...would rather keep the code local to the app instead of a DLL inclusion.

This post has been edited by woodjom: 19 Jul, 2008 - 06:59 PM
User is offlineProfile CardPM
+Quote Post

Locke37
RE: C/cpp Conversion To Vb
19 Jul, 2008 - 08:05 PM
Post #2

Contributor of the Year
Group Icon

Joined: 20 Mar, 2008
Posts: 1,274



Thanked: 57 times
Dream Kudos: 325
My Contributions
To any mod/admin that reads this, it's a VB.Net topic!
___________________________________

Welp, I'm not a good C++ guy, so sorry, I can't help you.

This post has been edited by Locke37: 19 Jul, 2008 - 08:06 PM
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: C/cpp Conversion To Vb
19 Jul, 2008 - 09:15 PM
Post #3

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Moved to VB.NET smile.gif
User is offlineProfile CardPM
+Quote Post

Martyr2
RE: C/cpp Conversion To Vb
19 Jul, 2008 - 09:56 PM
Post #4

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,660



Thanked: 313 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
VB.NET doesn't work well at all with pointers. The concept pretty much doesn't exist in the language. Even though it does have objects of type Int32Ptr which can be used for basic pointer operations, it won't be that useful to you for pointing to functions.

You could look into delegates though. A delegate can be associated with a function and by using the delegate you can pass around a call to a particular function. Much like passing around a pointer to a function.

But there is no direct equivalent. .NET has made tremendous strides to get away from pointers because it can lead to memory corruption and in .NET the framework handles much of the memory allocation and garbage collection.

Sorry. smile.gif
User is offlineProfile CardPM
+Quote Post

woodjom
RE: C/cpp Conversion To Vb
19 Jul, 2008 - 11:00 PM
Post #5

New D.I.C Head
*

Joined: 8 May, 2008
Posts: 46



Thanked: 1 times
My Contributions
yeah i know that VB doesnt have pointers per say....about as close to pointers as VB gets is in functions when passing arguments with ByRef....but there is a comprable to the above statement just not sure if the venture would be worth it or if i should just leave it in C/CPP.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 01:46AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month