?
Solved

Create DLL using Turbo C ?

Posted on 1998-10-18
4
Medium Priority
?
1,353 Views
Last Modified: 2008-02-26
How can I create DLL for my Visual Basic Application using turbo C?
0
Comment
Question by:anik
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 1

Expert Comment

by:mlaiosa
ID: 1253679
what version of turbo C, of VB
0
 

Author Comment

by:anik
ID: 1253680
turbo C++ 3.0, Visual Basic 6.0
0
 
LVL 1

Accepted Solution

by:
prozak earned 30 total points
ID: 1253681
I haven't actually done this with TC but I can tell you how to do it with MS VC++. All of you functions must be declared with the extern "C" qualifier if you're using C++ to prevent name mangling. Additionally all the functions that will be called by you VB program must be declared as stdcall (This affects how arguments are passed to function). And finally when compiling the DLL (this is under VC++ only as far as I know) I had to define a .def (module definition) file and specifically export each function in that, otherwise when I called the function from VB I would get an error "Could not find entry point" or something like that. Also when you declare the function in VB if it's ByVal then you just get the value (i.e. ByVal myVar As Long would be long myvar in C and ByRef myVar as Long would be long *myvar in C. After reading this last sentence, I guess you could've figured that one out by yourself :) Strings must be passed as ByVal so VB can do the translation from a multi-byte string (16-bit characters) to a byte string (8-bit ASCII characters). The only way I've found to get access to the multi-byte versions of VB strings is if the value is passed as type Variant. If you try to pass the string as ByRef, you get a pointer to a pointer to the string but VB still packs all the characters to 8-bits. All of this info is for VB5. I haven't used VB6 yet but I've heard that in this respect it is the same.
Hope this helps!
0
 

Expert Comment

by:peterpan1975
ID: 1253682
there (at VStudio vb cd) is a file vb5dll.doc:
\vb5.0\tools\docs
very good explanation how to connect VC 4.0 dll's to vb... Im not sure if it applies to TC, but I hope it might be helpful as well :)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question