Valhalla Legends Forums Archive | Battle.net Bot Development | Including BNCSutil.dll binary in a C++ application

AuthorMessageTime
Okee
I'm well aware of how to use a dll file with a visual basic application. I'm not quite sure how to do so in my C++ bot, though. I scrapped the idea of just taking the function needed from the source, because of some end of file error. I decided to just use the dll.

Do I go into project settings, under the link tab, and put it in there with all the .lib files? I also need to include the headers in the program, right?

I did these two things, and it didn't seem to let me use functions from the dll. Maybe I didn't put some #include's in the correct spot? I only put one #include in my main.cpp file (all my bot functions reside in main.cpp for now), and I included the checkrevision.h file.

Is there anything special I need to do other than this?
May 3, 2005, 1:20 AM
shadypalm88
[quote author=Okee link=topic=11472.msg110869#msg110869 date=1115083246]
I'm well aware of how to use a dll file with a visual basic application. I'm not quite sure how to do so in my C++ bot, though. I scrapped the idea of just taking the function needed from the source, because of some end of file error. I decided to just use the dll.

Do I go into project settings, under the link tab, and put it in there with all the .lib files? I also need to include the headers in the program, right?

I did these two things, and it didn't seem to let me use functions from the dll. Maybe I didn't put some #include's in the correct spot? I only put one #include in my main.cpp file (all my bot functions reside in main.cpp for now), and I included the checkrevision.h file.

Is there anything special I need to do other than this?
[/quote]

[list]
[*] Make sure that that the src folder in the bncsutil distribution is added to your list of include directories.
[*] Do #include <bncsutil/bncsutil.h> in files where you need BNCSutil finctions.
[*] Add the library to the list of libraries in the linker options.[/list]
May 3, 2005, 2:01 AM
Okee
I added the directory to the list of included paths, and now it cannot locate gmp.h. Is this is problem encountered by anyone else?

This is what Im lookin at:

[quote]
bncsutil\mutil_types.h(70) : error C2632: 'long' followed by 'long' is illegal
bncsutil\mutil_types.h(71) : error C2632: 'long' followed by 'long' is illegal
bncsutil\nls.h(30) : fatal error C1083: Cannot open include file: 'gmp.h': No such file or directory
[/quote]
May 3, 2005, 3:42 AM
K
[quote author=Okee link=topic=11472.msg110903#msg110903 date=1115091743]
I added the directory to the list of included paths, and now it cannot locate gmp.h. Is this is problem encountered by anyone else?

This is what Im lookin at:

[quote]
bncsutil\mutil_types.h(70) : error C2632: 'long' followed by 'long' is illegal
bncsutil\mutil_types.h(71) : error C2632: 'long' followed by 'long' is illegal
bncsutil\nls.h(30) : fatal error C1083: Cannot open include file: 'gmp.h': No such file or directory
[/quote]
[/quote]

I've never used it, so I don't know if it includes it or not, but gmp.h is the gnu multiple precision library -- try searching for that and downloading it as well.

"long long" is the gcc terminology for a 64bit integer.  Again without having ever looked at the code, you might need to change it to whatever your compiler's terminolgy is (ie __int64 for msvc).
May 3, 2005, 5:02 AM
Okee
I did what K said, and its working, now. When it tries to link, though, it gives the following error..

[quote]Linking...
BNCSutil.dll : fatal error LNK1136: invalid or corrupt file
Error executing link.exe.[/quote]

I've got the dll located in the vc6 search dir with the other lib files, c:/.../vc6/Lib, in the projects dir, and in System32. I'm linking it by including it in project settings, with all the other lib files, such as ws2_32.lib. This seems to be what shadypalm88 said to do? How should I be doing this?
May 3, 2005, 9:27 PM
Okee
*bump*

Anyone know? Is there a lib file for this dll somewhere?
May 4, 2005, 10:13 PM
shadypalm88
Try redownloading the zip package.  It now includes the import library.
May 4, 2005, 10:23 PM
Newby
I thought hyper was 64bit integer in msvc. :(
May 5, 2005, 12:04 AM
shadypalm88
[quote author=K link=topic=11472.msg110905#msg110905 date=1115096555]
[quote author=Okee link=topic=11472.msg110903#msg110903 date=1115091743]
I added the directory to the list of included paths, and now it cannot locate gmp.h. Is this is problem encountered by anyone else?

This is what Im lookin at:

[quote]
bncsutil\mutil_types.h(70) : error C2632: 'long' followed by 'long' is illegal
bncsutil\mutil_types.h(71) : error C2632: 'long' followed by 'long' is illegal
bncsutil\nls.h(30) : fatal error C1083: Cannot open include file: 'gmp.h': No such file or directory
[/quote]
[/quote]

I've never used it, so I don't know if it includes it or not, but gmp.h is the gnu multiple precision library -- try searching for that and downloading it as well.

"long long" is the gcc terminology for a 64bit integer.  Again without having ever looked at the code, you might need to change it to whatever your compiler's terminolgy is (ie __int64 for msvc).
[/quote]It's strange that he's getting this error.  I assumed from looking at the error messages and his mention of "project settings" that he's using some version of Visual C++, or at least a Microsoft C++ compiler.  From mutil_types.h:[code]#ifdef _MSC_VER
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
typedef long long int64_t;
typedef unsigned long long uint64_t;
#endif[/code](Full File)

The rest of the lib uses [u]int64_t, so I don't know what could be causing that error.
May 5, 2005, 2:21 AM

Search