Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Okee on May 02, 2005, 08:20 PM

Title: Including BNCSutil.dll binary in a C++ application
Post by: Okee on May 02, 2005, 08:20 PM
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?
Title: Re: Including BNCSutil.dll binary in a C++ application
Post by: shadypalm88 on May 02, 2005, 09:01 PM
Quote from: Okee on May 02, 2005, 08:20 PM
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?

Title: Re: Including BNCSutil.dll binary in a C++ application
Post by: Okee on May 02, 2005, 10:42 PM
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
Title: Re: Including BNCSutil.dll binary in a C++ application
Post by: K on May 03, 2005, 12:02 AM
Quote from: Okee on May 02, 2005, 10:42 PM
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

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).
Title: Re: Including BNCSutil.dll binary in a C++ application
Post by: Okee on May 03, 2005, 04:27 PM
I did what K said, and its working, now. When it tries to link, though, it gives the following error..

QuoteLinking...
BNCSutil.dll : fatal error LNK1136: invalid or corrupt file
Error executing link.exe.

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?
Title: Re: Including BNCSutil.dll binary in a C++ application
Post by: Okee on May 04, 2005, 05:13 PM
*bump*

Anyone know? Is there a lib file for this dll somewhere?
Title: Re: Including BNCSutil.dll binary in a C++ application
Post by: shadypalm88 on May 04, 2005, 05:23 PM
Try redownloading the zip package.  It now includes the import library.
Title: Re: Including BNCSutil.dll binary in a C++ application
Post by: Newby on May 04, 2005, 07:04 PM
I thought hyper was 64bit integer in msvc. :(
Title: Re: Including BNCSutil.dll binary in a C++ application
Post by: shadypalm88 on May 04, 2005, 09:21 PM
Quote from: K on May 03, 2005, 12:02 AM
Quote from: Okee on May 02, 2005, 10:42 PM
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

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).
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:#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
(Full File) (http://svn.ionws.com/view/bncsutil/src/bncsutil/mutil_types.h)

The rest of the lib uses int64_t, so I don't know what could be causing that error.