libwebp in VB 6.0 programs.

217 views
Skip to first unread message

Александр Рощупкин

unread,
Oct 22, 2025, 4:49:43 AMOct 22
to WebP Discussion
Hello!
I want to use part of the libwebp library to view images in a program written in VB 6.0 on 32-bit systems (Windows XP x86).
I've declared declarations for two library functions:
Public Declare Function WebPGetDecoderVersion Lib "libwebp.dll" () As Long
Public Declare Function WebPGetInfo Lib "libwebp.dll" (ByRef Arr As Any, _
ByVal data_size As Long, ByRef Wwidth As Long, _
ByRef Wheight As Long) As Long
The first function works fine when called:
Label4.Caption = WebPGetDecoderVersion
The second function, when called:
Addr = WebPGetInfo(bRead(0), FSize - 1, ImgW, ImgH)
raises an error: "Bad DLL calling convention".
I tried compiling the parts I needed from the libwebp library. The decode.h file contains prototypes of the functions I need, but I couldn't find the functions themselves.
What should I do to find them?

James Zern

unread,
Oct 22, 2025, 4:13:00 PMOct 22
to webp-d...@webmproject.org
Hi,

On Wed, Oct 22, 2025 at 1:49 AM Александр Рощупкин <arosch...@gmail.com> wrote:
Hello!
I want to use part of the libwebp library to view images in a program written in VB 6.0 on 32-bit systems (Windows XP x86).
I've declared declarations for two library functions:
Public Declare Function WebPGetDecoderVersion Lib "libwebp.dll" () As Long
Public Declare Function WebPGetInfo Lib "libwebp.dll" (ByRef Arr As Any, _
ByVal data_size As Long, ByRef Wwidth As Long, _
ByRef Wheight As Long) As Long 
The first function works fine when called:
Label4.Caption = WebPGetDecoderVersion
The second function, when called:
Addr = WebPGetInfo(bRead(0), FSize - 1, ImgW, ImgH)
raises an error: "Bad DLL calling convention".

https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/error-messages/bad-dll-calling-convention has some guidance around this error. I'm not sure if the types are aligned correctly, but haven't tried this myself.
 
I tried compiling the parts I needed from the libwebp library. The decode.h file contains prototypes of the functions I need, but I couldn't find the functions themselves.
What should I do to find them?

If you're working from a git repository, you can use `git grep WebPGetInfo`. Otherwise something like `grep -R WebPGetInfo` can work. This function is defined in src/dec/webp_dec.c:
 

--
You received this message because you are subscribed to the Google Groups "WebP Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webp-discuss...@webmproject.org.
To view this discussion visit https://groups.google.com/a/webmproject.org/d/msgid/webp-discuss/e84dd7a0-c21c-48a1-80fa-6e24fda875a0n%40webmproject.org.

Александр Рощупкин

unread,
Oct 24, 2025, 4:34:03 PMOct 24
to WebP Discussion, James Zern
Hello, James!
Thanks for your reply. I don't use the repository. I just download what I need.
Apparently, the functions whose prototypes are specified in the decode.h file are generated by the preprocessor from macros.

I'm new to C++, so I don't know much yet.
I don't understand how to run the Visual Studio preprocessor to get the code for the functions I need from the decode.h file.

среда, 22 октября 2025 г. в 23:13:00 UTC+3, James Zern:

James Zern

unread,
Oct 24, 2025, 6:00:46 PMOct 24
to Александр Рощупкин, WebP Discussion
Hi,

On Wed, Oct 22, 2025 at 10:14 PM Александр Рощупкин <arosch...@gmail.com> wrote:
Hello, James!
Thanks for your reply. I don't use the repository. I just download what I need.

I suggest building libwebp.dll using Makefile.vc. In a Visual Studio command prompt `nmake -f Makefile.vc CFG=release-dynamic` should work.
 
Apparently, the functions whose prototypes are specified in the decode.h file are generated by the preprocessor from macros.

No, the functions are defined in the file I mentioned: src/dec/webp_dec.c. If I'm misunderstanding, can you point to the macros you're talking about?

Александр Рощупкин

unread,
Oct 30, 2025, 6:20:38 AM (13 days ago) Oct 30
to WebP Discussion, James Zern, WebP Discussion, Александр Рощупкин
Hi, James!

 Macros: 
"MAKE_DECODER_VERSION(WebPDecodeRGB, RGB) MAKE_DECODER_VERSION(WebPDecodeRGBA, RGBA) MAKE_DECODER_VERSION(WebPDecodeARGB, ARGB) MAKE_DECODER_VERSION(WebPDecodeBGR, BGR) MAKE_DECODER_VERSION(WebPDecodeBGRA, BGRA)"

суббота, 25 октября 2025 г. в 01:00:46 UTC+3, James Zern:

James Zern

unread,
Oct 30, 2025, 4:00:13 PM (13 days ago) Oct 30
to WebP Discussion
Hi,

On Wed, Oct 29, 2025 at 11:30 PM Александр Рощупкин <arosch...@gmail.com> wrote:
Hi, James!

 Macros: 
"MAKE_DECODER_VERSION(WebPDecodeRGB, RGB) MAKE_DECODER_VERSION(WebPDecodeRGBA, RGBA) MAKE_DECODER_VERSION(WebPDecodeARGB, ARGB) MAKE_DECODER_VERSION(WebPDecodeBGR, BGR) MAKE_DECODER_VERSION(WebPDecodeBGRA, BGRA)"

These aren't a part of libwebp. Are they from your implementation or somewhere else? Do you have a link to the source code?

Александр Рощупкин

unread,
Oct 31, 2025, 4:43:38 AM (12 days ago) Oct 31
to WebP Discussion, James Zern, WebP Discussion
Hi, James!
Here is the link to the source codes:
I managed to create a wrapper library for libwebp.dll and use it in a program written in VB 6.0.

четверг, 30 октября 2025 г. в 23:00:13 UTC+3, James Zern:

James Zern

unread,
Nov 3, 2025, 10:36:49 PM (8 days ago) Nov 3
to WebP Discussion
Hi,

On Fri, Oct 31, 2025 at 1:12 AM Александр Рощупкин <arosch...@gmail.com> wrote:
Hi, James!
Here is the link to the source codes:

This looks to use a very old version of libwebp (1.0.0). If possible, it would be best to the latest release, 1.6.0, or at least 1.0.3 in that set of patch releases. They both contain import bug/security related fixes.
 
I managed to create a wrapper library for libwebp.dll and use it in a program written in VB 6.0.

That's great to hear. If you have any other details about how you did that, it may help others if you can post the steps to this thread.

Александр Рощупкин

unread,
Nov 4, 2025, 1:59:49 AM (8 days ago) Nov 4
to WebP Discussion, James Zern
Hello, James!
Here's a link to the finished result:
https://disk.yandex.ru/d/vrWheggvXeRexw
Both programs work on Windows XP, Windows 7, and Windows 10 x64.

вторник, 4 ноября 2025 г. в 06:36:49 UTC+3, James Zern:
Reply all
Reply to author
Forward
0 new messages