×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

VB + C INTEGRATION

VB + C INTEGRATION

VB + C INTEGRATION

(OP)
How can  i integrate the programming languages.For example i have a subroutine in c program and want to add it to my VB program. I want a but to call the c-subroutine and return the values to the VB program. Can this be done ? how ?

RE: VB + C INTEGRATION

There are *lots* of ways to integrate programming languages.  You picked one of the toughest ways.

To call code written in one programming language from code written in another programming language, you have to know the following things:
  1.  How does each language lay out their stack?  This one is REAL important.  The stack is where many languages -- C is one of them -- look for:
      a. variables that are passed to the subroutine
      b. the return address in the calling program
  2.  Who is responsible for cleaning up the stack
  3.  How big are those variables on the stack?  What is the bit order of each variable?

There are easier ways to solve this problem.  Writing a file is one of them.  Using pipes is another if your operating system supports pipes.

    -Kevin

RE: VB + C INTEGRATION

(OP)
Thanx for the reply  kevin but i really want to know the exactly way to connect the two. Say for example i have
1) two text boxes in VB for input
2) a button
3) a picture box to diplay output
4) a subroutine in c that takes in two number adds them a gives back a resulting variable.
Now how do i make the button pass the values from the text boxes to the subroutine and get the result variable to be displayed back in the picture box.
I want to know this becoz i have huge matrix calculation in C and its very cumbersome to re-write them in VB. Hope u have a solution for this. Thanx once again.
alpesh

RE: VB + C INTEGRATION

If VB has SHELL ( command which calls other .EXE or system
commands ) you can write file SHELL to the C progran which
writes the result to a file which the C can read.

<nbucska@pcperipherals.com>

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources