Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

Call a 32 bit dll in VB 5.0

Posted on 1998-11-20
5
Medium Priority
?
167 Views
Last Modified: 2010-05-03
I have an application that calls a DLL. The dll is written in c. One of the elements that is passed to the dll is a defined type (structure in c). The structure occurs more than once. It is an array of structures. When I return from the dll I receive an access violation. If I change the structure to a string and call the DLL the program returns the data fine. I have no idea why!
0
Comment
Question by:pantosie
[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
5 Comments
 
LVL 3

Expert Comment

by:rmichels
ID: 1445978
Did you write the C dll?  Can you post the code, from VB and C..the declare and call from VB (along with the user defined type  for the structure)..and the code in C (the function definition especially)..but also the code in the function
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1445979
Take a look at this website. It shows you the maximum of what you can do with structs and VB/C

http://www.worldofatl.com/LegalDownload.asp?URL=Downloads/WorksWithVB.zip&DESC=Structs & VB&LIB=True
0
 

Author Comment

by:pantosie
ID: 1445980
The answer was just a referral to a web site. I hav done some investigation and I ascertained the follwing. I have 3 choices:
1) Pass the data as a string
2) Rewrite the C so it wil accept a safe array. When you pass structures in VB 5 it passes an array of pointers to each ocurrence. You must change the c.
3) Place a wrapper around the old 16 bit DLL and call it from the wrapper (thunk script)
0
 

Expert Comment

by:gsommer
ID: 1445981
You need to give us more information, like what the structure is that you are passing, and whether the data is going in to the DLL, out from it, or both.

Also, how does the DLL know how many elements are passed in through the array?  Is there another parameter that contains that value?
0
 
LVL 13

Accepted Solution

by:
Mirkwood earned 200 total points
ID: 1445982
When your DLL is a 16 bit dll, you have no choice but to create a thunk. (This is really horrible to do btw).

Otherwise the "just a  reference" is the best answer you could get. It includes a sample of what is possible and what is not.
0

Featured Post

Industry Leaders: 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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

647 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