Jump to content

DllCall problem


Go to solution Solved by UEZ,

Recommended Posts

I have libpq PosgreSQL library

I wrote this example code:

Local $Conn = DllCall(@ScriptDir & "\libpq.dll","int","PQlibVersion","none","")
If @error Then
    MSGBox(64,"@error",'Error DllCall: ' & ' Error: ' & @error & ' Extended: ' & @extended & @CR)
EndIf

@error is always 1. 

I've tried change path to this dll, tried change types of parameters from "int" to "int*" and from "none" to "none*", tryed change function call type to :cdecl... - nothing. 

What I'm Doing Wrong?

I just need to access my PostgreSQL database without ODBC (user have no admin rights to install it). 

Link to comment
Share on other sites

Try

Local $Conn = DllCall(@ScriptDir & "\libpq.dll","int","PQlibVersion")

or if cdecl calling method

Local $Conn = DllCall(@ScriptDir & "\libpq.dll","int:cdecl","PQlibVersion")

 

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

  • Solution

Maybe there are some dependencies missing (exports) for libpq.dll

WS2_32.dll
libintl-9.dll
Secur32.dll
WLDAP32.dll
libssl-3-x64.dll
libcrypto-3-x64.dll
KERNEL32.dll
SHELL32.dll
ADVAPI32.dll
VCRUNTIME140.dll
api-ms-win-crt-heap-l1-1-0.dll
api-ms-win-crt-convert-l1-1-0.dll
api-ms-win-crt-string-l1-1-0.dll
api-ms-win-crt-stdio-l1-1-0.dll
api-ms-win-crt-runtime-l1-1-0.dll
api-ms-win-crt-environment-l1-1-0.dll
api-ms-win-crt-time-l1-1-0.dll
api-ms-win-crt-utility-l1-1-0.dll
api-ms-win-crt-math-l1-1-0.dll
api-ms-win-crt-locale-l1-1-0.dll
api-ms-win-crt-filesystem-l1-1-0.dll

because

DllOpen(@ScriptDir & "\libpq.dll")

returns -1 which is not ok.

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

1 hour ago, UEZ said:

Maybe there are some dependencies missing (exports) for libpq.dll

WS2_32.dll
libintl-9.dll
Secur32.dll
WLDAP32.dll
libssl-3-x64.dll
libcrypto-3-x64.dll
KERNEL32.dll
SHELL32.dll
ADVAPI32.dll
VCRUNTIME140.dll
api-ms-win-crt-heap-l1-1-0.dll
api-ms-win-crt-convert-l1-1-0.dll
api-ms-win-crt-string-l1-1-0.dll
api-ms-win-crt-stdio-l1-1-0.dll
api-ms-win-crt-runtime-l1-1-0.dll
api-ms-win-crt-environment-l1-1-0.dll
api-ms-win-crt-time-l1-1-0.dll
api-ms-win-crt-utility-l1-1-0.dll
api-ms-win-crt-math-l1-1-0.dll
api-ms-win-crt-locale-l1-1-0.dll
api-ms-win-crt-filesystem-l1-1-0.dll

because

DllOpen(@ScriptDir & "\libpq.dll")

returns -1 which is not ok.

Big thanks to you! It may be the solution. I'll try to find all dependecies and write the result here!

Link to comment
Share on other sites

On 9/12/2024 at 5:29 PM, UEZ said:

Maybe there are some dependencies missing (exports) for libpq.dll

WS2_32.dll
libintl-9.dll
Secur32.dll
WLDAP32.dll
libssl-3-x64.dll
libcrypto-3-x64.dll
KERNEL32.dll
SHELL32.dll
ADVAPI32.dll
VCRUNTIME140.dll
api-ms-win-crt-heap-l1-1-0.dll
api-ms-win-crt-convert-l1-1-0.dll
api-ms-win-crt-string-l1-1-0.dll
api-ms-win-crt-stdio-l1-1-0.dll
api-ms-win-crt-runtime-l1-1-0.dll
api-ms-win-crt-environment-l1-1-0.dll
api-ms-win-crt-time-l1-1-0.dll
api-ms-win-crt-utility-l1-1-0.dll
api-ms-win-crt-math-l1-1-0.dll
api-ms-win-crt-locale-l1-1-0.dll
api-ms-win-crt-filesystem-l1-1-0.dll

because

DllOpen(@ScriptDir & "\libpq.dll")

returns -1 which is not ok.

In fact, I only needed one of the dependencies: libintl-9.dll 

Spoiler

which is found at C:\Program Files\PostgreSQL\16\pgAdmin 4\runtime

Thank you very much! Marked your answer as  the solution.

Edited by noknown
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...