noknown Posted September 12 Share Posted September 12 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 More sharing options...
UEZ Posted September 12 Share Posted September 12 (edited) Try Local $Conn = DllCall(@ScriptDir & "\libpq.dll","int","PQlibVersion") or if cdecl calling method Local $Conn = DllCall(@ScriptDir & "\libpq.dll","int:cdecl","PQlibVersion") Edited September 12 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 More sharing options...
noknown Posted September 12 Author Share Posted September 12 1 hour ago, UEZ said: Try Local $Conn = DllCall(@ScriptDir & "\libpq.dll","int","PQlibVersion") or if cdecl calling method Local $Conn = DllCall(@ScriptDir & "\libpq.dll","int:cdecl","PQlibVersion") Unfortunately hadn't work, but thanks! Link to comment Share on other sites More sharing options...
Solution UEZ Posted September 12 Solution Share Posted September 12 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. pixelsearch 1 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 More sharing options...
noknown Posted September 12 Author Share Posted September 12 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 More sharing options...
noknown Posted September 14 Author Share Posted September 14 (edited) 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 September 14 by noknown Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now