473,413 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

DLL's

I am trying to call an unmanaged function from vb.net. I have declared the DLL as follows:

Private Declare Function uncompress Lib "zlib.dll" (ByRef dest As Byte(), ByVal destLen As Long, ByRef src As Byte(), ByVal srcLen As Long) As Long

When I try to call the function, I get an error "Object Referennce not set to instance of object". I have dimensioned all the byte arrays and the other two variables to long.

I think it's in the way the variables are handled in unmanaged code versus vb.net but not sure exactly what to do. Any help would be very much appreciated.

Dennis in Houston
Nov 20 '05 #1
4 1260
Hi Dennis,

Without to look at your questior further, did you know that a classic VB
Long is now an Integer?

I think that you have first to past that part.

Cor
Nov 20 '05 #2
* =?Utf-8?B?RGVubmlz?= <De****@discussions.microsoft.com> scripsit:
I am trying to call an unmanaged function from vb.net. I have declared the DLL as follows:

Private Declare Function uncompress Lib "zlib.dll" (ByRef dest As Byte(), ByVal destLen As Long, ByRef src As Byte(), ByVal srcLen As Long) As Long


Your declare is wrong:

<URL:http://groups.google.de/groups?selm=u3sUJ8QVCHA.2336%40tkmsftngp09>

BTW: If you are looking for a managed ZIP solution:

<URL:http://www.icsharpcode.net/OpenSource/SharpZipLib/>

The VB.NET Resource Kit contains zipping functionality too:

<URL:http://msdn.microsoft.com/vbasic/vbrkit/>

It contains ComponentOne Zip for .NET:

<URL:http://www.componentone.com/products.aspx?ProductCode=1&ProductID=26>

Using J#'s zip functionality:

<URL:http://msdn.microsoft.com/msdnmag/issues/03/06/zipcompression/print.asp>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3
Thanks for answer. I now understand that a long in previous VB versions is now an integer in VB.Net and already did know that strings were ANSI vs Unicode also. I'm still a bit confused as to how to pass arrays from vb.net to standard DLL's and how to declare them in both the declare statement for the standard dll function and how to delcare them in the calling function.
--
Dennis in Houston
"Herfried K. Wagner [MVP]" wrote:
* =?Utf-8?B?RGVubmlz?= <De****@discussions.microsoft.com> scripsit:
I am trying to call an unmanaged function from vb.net. I have declared the DLL as follows:

Private Declare Function uncompress Lib "zlib.dll" (ByRef dest As Byte(), ByVal destLen As Long, ByRef src As Byte(), ByVal srcLen As Long) As Long


Your declare is wrong:

<URL:http://groups.google.de/groups?selm=u3sUJ8QVCHA.2336%40tkmsftngp09>

BTW: If you are looking for a managed ZIP solution:

<URL:http://www.icsharpcode.net/OpenSource/SharpZipLib/>

The VB.NET Resource Kit contains zipping functionality too:

<URL:http://msdn.microsoft.com/vbasic/vbrkit/>

It contains ComponentOne Zip for .NET:

<URL:http://www.componentone.com/products.aspx?ProductCode=1&ProductID=26>

Using J#'s zip functionality:

<URL:http://msdn.microsoft.com/msdnmag/issues/03/06/zipcompression/print.asp>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #4
* =?Utf-8?B?RGVubmlz?= <De****@discussions.microsoft.com> scripsit:
Thanks for answer. I now understand that a long in previous VB
versions is now an integer in VB.Net
ACK. 'Long' is now a 64-bit datatype.
I'm still a bit confused as to how to pass arrays from vb.net to
standard DLL's and how to declare them in both the declare statement for
the standard dll function and how to delcare them in the calling
function.


That is very similar to how it was done in VB6, but the answer depends
on what the function is expecting.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Stefan | last post by:
Hi, I just downloaded PHP-4.3.3 for win32 and got the extensions folder and dropped it intot he root of the PHP directory and set it's path in the PHP.ini: extension_dir =...
3
by: Matthias Baas | last post by:
Hi, are there any guidelines about what to do if a Windows extension for Python 2.4 requires the C++ runtime (msvcp71.dll)? If I want to distribute a binary installer of an extension that...
24
by: Toby Mathews | last post by:
Hi there, I have recently started having problems compiling multi-project solutions. I have a couple of ASP.Net projects that reference a range of .Net DLLs I have written. For example: ...
4
by: Matt Sawyer | last post by:
I am attempting to use an API (CxApiOem.dll) that has a large number of defines and complicated structs. It's just too much hassle to attempt to use DLLImport to make the desired API calls. ...
11
by: Vijay Chegu | last post by:
I have built a 64bit ATL COM dll. When i register the dll on IA64 windows Enterprise server 2003, i get following error. DllRegisterServer in mydll.dll failed. Return code was : 0x80020009 ...
2
by: Kevin R. | last post by:
I have been ignoring this problem for a few weeks now, but it's becoming a bit annoying not to mention unproductive. Here it goes: I compile my project with no errors. Then after I debug/run it,...
4
by: james margey | last post by:
Hi to all, I have spent 3 days at this error and i have two days to go for a deadline, and i am about to go off my nut, the reason being: Microsoft dont seem to be able to provide a solution, I...
22
by: Brett Romero | last post by:
If my UI app uses three DLLs and two of those DLLs reference something named utilities.dll, does the UI app load utilities.dll twice or does the compiler recognize what is going on and load...
0
by: HeroOfSpielburg | last post by:
Hello, I'm new to the realm of .NET application creation, so please forgive my ignorance. I have been tasked with debugging a problem that arises with using a DLL that contains managed and...
1
by: jabbari | last post by:
Hello, Please Help us...! I have a big problem ,so i searched on google and other search engine ,then I realized that so many other people have the same problem and they, all, have'nt been able to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.