Usage of syscall for constants

I dont know exactly what it does but i understood that it will load SQLAllocHandle function to the procSQLAllocHandle.

mododbc32 = syscall.NewLazyDLL(GetDllName())
procSQLAllocHandle     = mododbc32.NewProc("SQLAllocHandle")

In the same there any function load the constants to the variable instead of giving the magic numbers.

SQL_BLOB = mododbc32.NewConst(“SQL_BLOB”) (EXAMPLE)

There is not, in the Go syscall DLL loading stuff. Even if there were, magic numbers in C are typically preprocessor macros (#define) which doesn’t survive compilation and isn’t present in the object file.

So if i want them,i have to declare it or i have to include the #define file and import C and use the macros.

If i want to load the same file in linux how to load it…because that NewLazyDLL api is for windows but not for unix. Is there any equivalent to load the file.


There are ways, google for “dlopen”.

dlopen is an different package, is there any way to open with syscall.
Beacause NewLazyDLL func is in dll_windows.go file, so in the same way is there any file for unix.


Thanks @calmh

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.