Solved

Create DLL using Turbo C ?

Posted on 1998-10-18
4
1,332 Views
Last Modified: 2008-02-26
How can I create DLL for my Visual Basic Application using turbo C?
0
Comment
Question by:anik
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 10 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
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.

839 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