Archived

This topic is now archived and is closed to further replies.

jollyjeffers

DLL's

Recommended Posts

jollyjeffers    1570
hi, Anyone here have any experience of using C/C++ and Visual Basic? y''see I''m writing the level editor/compiler in visual basic (much easier and quicker) but there are several things that I can, quite literally, setup in VB and go make a cup of tea, come back and it still be trundling away... (My lighting engine being one) So. I want to write most of the time critical/maths for the editor in a C/C++ DLL and link that to my VB editor. The code for the DLL is no problem - nothing new there. What I want to know - if I have a "D3DVECTOR" in C/C++ and a "D3DVECTOR" in VB - are they interchangeable? Assuming all the members (X/Y/Z) are all of the same datatype - could I pass an array from my VB program to the DLL and back again? Anyone ever tried this? Any help is much appreciated. Jack,

Share this post


Link to post
Share on other sites
Houdini    266
I''d recommend using COM DLLs. The reasoning is I know for certain you can use it with both C++ and VB (as well as ASP pages through VBScript if you so desired ). Also, since COM DLLs use interfaces you can make updates to the DLL without it breaking existing applications.

BTW, DirectX is written in a COM DLL which can be used with both VB and C, so yes, D3DVECTOR would be the same between them.

- Houdini

Share this post


Link to post
Share on other sites
jollyjeffers    1570
cheers;

I looked into making some COM DLL''s in VC++6 - but it turned out you needed the enterprise edition...

If I remember correctly, in VB, D3DVECTOR is

Type D3DVECTOR
X as single
Y as single
Z as single
End Type

and in C++ it''s

typedef D3DVECTOR
float X
float Y
float Z

so it should be okay...

Jack,

Share this post


Link to post
Share on other sites
jollyjeffers    1570
I''ve got the DLL working - sort of...

Anyone familiar with VB will know that you declare DLL''s using ByRef or ByVal...

You can pass UDT''s ByVal- you have to send them ByRef...
But I can seem to make my C++ DLL allow a pointer to a UDT...

There''s a tutorial (for VB developers) on www.vbexplorer.com/directx4vb/
I think it''s in the general Code section...



Share this post


Link to post
Share on other sites