• Welcome to Valhalla Legends Archive.
 

Including BNCSutil.dll binary in a C++ application

Started by Okee, May 02, 2005, 08:20 PM

Previous topic - Next topic

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?

shadypalm88

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?


  • 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.

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

K

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).

Okee

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?

Okee

*bump*

Anyone know? Is there a lib file for this dll somewhere?

shadypalm88

Try redownloading the zip package.  It now includes the import library.

Newby

- Newby

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.

shadypalm88

#8
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)

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