Newsgroup: it.comp.lang.c++
Titolo: Visual Basic & C or C++

I need to write a stock control system and I have decided to do the front
end in visual basic and all the number crunching in c or c++, does anyone
have any idea on how to achive this.  I suspect that the code written in c
or c++ would have to be compiled as a dll is this the case? and if so how is
this achieved.  I have borland c/c++ v 3 as well as visual c++ 1.5 and v
2.0.  The version of visual basic I am using is 3 although I might end up
using version 5.
Thank you all for your time, and I look forward to hearing from you all.
Please I am not exactly what you would call an expert at this so please keep
it as simple as possible.  This might be a tough task but it is for an
assessment at college ans I want to impress, that is why I am trying to do
it like this.  I know that visual basic could handle it all for me but I am
lead to believe that if I use c or c++ for the number crunching this will
speed my program up no end.  Anyway that's enough of that, like I said I
hope to be hearing from you all very soon.
Neil Cameron
ncam...@fife.ac.uk

yes ... what you want to do is very straight-forward
compile all your c/c++ code as dll's and execute them through the VB
I do this alot!
I'm not going to give you any pointers on this ..... I'm going to recommend
that you buy
"Visual Basic Developer's Workshop" by Craig and Webb (Microsoft Press)
which covers this material
on pages 420 and so ....
Enjoy!
--
Edward Leibnitz 
e...@sdots.com
 
http://www.sdots.com
Neil Cameron wrote in message ...


using version 5.
While I would have recommended doing what you are doing several years ago, 
with the software available now this idea make no sense. There are two C++ 
products available now (Borland C++Builder and Sybase's Optima++) that allow 
you to create a front end in the same manner as in VB. MIxing C++ and VB is a 
major pain so doing it all in C++ will save you a lot of headaches.
John - N8086N
Organizer and Executive Vice President of the 
"Vast Right-Wing Conspiracy"
------------------------------------------------
Home Page:
http://home.att.net/~miano
Home of the Delphi Component Writers' FAQ
EMail Address:
|m.i.a.n.o @    |
|w.o.r.l.d.n.e.t . |
|a.t.t .| 
|n.e.t |
Full Name:
-------------------
-J.o.h.n?M.i.a.n.o-
-------------------

 major pain so doing it all in C++ will save you a lot of headaches.
Well, I dont agree - making GUI is still far easier (and faster!) using VB than, 
say, MFC and I wouldnt call 'pain' the calling of some C-written functions from 
a DLL - all you have to do is to load the library and provide the right prototypes. 
The making of the DLL is straightforward, too, at least in WIN32.
Alternatively, Neil may consider the use of something like BorlandC++ builder (which
has a much more *visual* GUI construction than other C++ environments) - but with
his requirements he could easily succeed.
-Cris
-- 
Cristiano Sadun
Software Engineering & Consulting
email address: cris#sun6$itim$mi$cnr$it 
(for actual address please replace # by @ and $ by .)

Thank you for your comments, but I have created a very simple dll just to
test and make sure I am capable of doing this before trying something a bit
more demanding.  I created the dll in visual c++ v1.5 and here is the c
code.
int num ();
int num()
{
    return 10;
}
and the vb code
declare function num lib "test" () as integer
and all I have done is to display the returned value in a text box, the
thing is every time I try to execute the vb file I get an error message
saying file not found and the line that assigns the variable number in vb to
the value returned from the function call num() in the dll is highlighted.
Any idea as to what the problem could be?  Is there any specific place where
the dll has to go i.e. in the windows directory, because I have tried this
with no luck.
As you can tell I have not worked with dll's before so I am new to this,
please be as basic in your response as possible.
Thanx
Neil
ncam...@fife.ac.uk


please be as basic in your response as possible.
There are several tricks required to get DLLs to work with VB {which is why I 
suggested using C++Builder or Optima++ :-) }
1. You need to declare all of your exported DLL functions as
extern "C"
to get rid of name mangling.
2. All of your exported DLL functions must use the Pascal calling convention. 
Compiler's for windows generally have a modifier such as __pascal for this.
3. All of your functions should be either void or return an integer.
On the VB side
1. You have to specify the DLL file name in the VB declaration.
2. All string parameters should be declared as byval.
3. Do not declare any functions to take array parameters or structures 
containing strings other than fixed length strings (*N).
These are some things to get you started. It will work....eventually.


Can anyone help?
I need someone to code the CGI for a Unix Server to enable the following:
I have designed a framed website with links to UK, Holland, Germany and
France areas of the website.
When the viewer is looking at their own language I want them to be able to
fill in a response form and have it validated i.e. you have not filled in
the required fields etc. then send a formated email reply to the appropriate
country's dialup account.
So basically it is one CGI script that works then saved in four variants
with only the country's language and email address changed. Pretty simple I
would have done it but as I now use a Mac exclusively I can't find an editor
that wont mess up the code.
Anyone interested - if so how much?
Jon Shepherd
The Creative Edge
jonsh...@btinternet.com
Mobile: 0498 612519
Tel/Fax: 
+44 1376 340463

Why don't you try C++ Builder ?
*** SPARTACO ***
-> 
amu...@tin.it
 <-
http://www.pegacity.it/informatica/case/473/index.htm