Link to home
Start Free TrialLog in
Avatar of kh5395
kh5395

asked on

Using "ntypes.h"

I am trying to produce a program for Netware using C, but cannot get the header file ntypes.h to compile. Does anyone have any ideas why this is and how to solve the problem?
Thanks.
Avatar of cookre
cookre
Flag of United States of America image

I've had a few hassles with certain structures when using Watcom to create some NLMs (N_PLAT_NLM defined).  Since that's all I use Watcom for, I've buggered up several of the header files to avoid the redefinitions I get.

What errors are you getting?  Which compiler?  Which SDK?

Avatar of kh5395
kh5395

ASKER

The error message I am getting is :-
Cannot open include file: 'ntypes.h': No such file or directory - yet the file is there and included in the project.

The Complier is MS C++ Ver 6 and the SDK is form the Novell Devellopers web Site under the title of' NDS Libraries for C'.

Part of my problem is that I don't really understand what the file is actually doing.
Thanks for your help.
For that compiler I bet you don't have the path to the SDK includes defined in:

Tools/Options
Directories tab
Show directories for: include files

Well, thats the way to get there on MS VC++ v5 - I don't have v6, but I'm sure there's some place to do the same thing, i.e., define search directories for #includes.


As to the second part, ntypes.h defines a whole raft of Netware API specific data types that are used EVERYWHERE throughout the SDK and that are highly platform dependant.

For example, many API calls refer to the Netware type 'nuint'.  By virtue of what ntypes.h does, 'nuint' will be either unsigned short, unsigned int, or unsigned long, depending on your N_PLAT_??? define.  For this compiler, I use:

#pragma pack(1)
#define N_PLAT_MSW4
#define N_ARCH_32

I'm glad I stuck this in here, 'cause I almost forgot something that would run you ragged trying to find.  The Netware API structures presume 1-byte allignment.  That's fun trying to debug if your compiler defaults to something else.

Hope this helps...
Avatar of kh5395

ASKER

#pragma pack(1)
#define N_PLAT_MSW4
#define N_ARCH_32

Are these statements placed in the header file or in the .c file?
And how do you ensure the compiler sticks to 1-byte allignment (is that what the "#pragma pack(1)" statement does?).

By the way the inlcude path was the problem. Can you provide an answer so  I can give you the points.

Thanks for your help.
Avatar of kh5395

ASKER

I can now compile the files but they fail when it comes to build. I get a series of errors of the type :-

readeff.obj : error LNK2001: unresolved external symbol _NWDSGetAttrName@20
readeff.obj : error LNK2001: unresolved external symbol _NWDSGetAttrCount@12

Do you have any idea of what is causing this?
(As well as setting the path for the include files I also set the path for the .dll files).
What do the .nlm files do and would the path for them need to be set?
THANKS
ASKER CERTIFIED SOLUTION
Avatar of cookre
cookre
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry, I left something off.

The NLMs are provided should you not already have them on your server.  They are used by other NLMs and are frequently auto-loaded by other NLMs running on the server that need them.

As far as the DLLs, I don't know specifically which ones you're refering to.  In general, it's your call as to whether or not you want to include DLLs into your program.  Doing so (static link) results in a large EXE, but guarantees your program will run on a client that doesn't have a particular DLL.  Not embedding the DLLs in your program (dynamic link) results in a smaller EXE, but requires that the DLLs be present on each client box.
Avatar of kh5395

ASKER

All the errors seem to be resolved, apart from an error message rellating to file netwin16.lib. The error message states "invalid or corrupt file". Do you know if there is there a conflict in using this file in a 32 bit compiler?
Thanks
You need to keep your 16- and 32-bit libraries away from each other.  Since you're writing a 32-bit client side program, you shouldn't have any of the 16 bit LIBs visible to the compiler or linker - they're a bit incompatible.

Go back and double check the directory path you gave to the linker.  You want

...\lib\win32

not

...\lib\win


If you explicitly included any of the LIBs in the project, make sure they're the xxx32.lib ones instead of xxx16.lib.


You may even want to consider deleting all of the 16 bit libs, unless you still have an older compiler that can create 16-bit exes and you think you might need to create a 16-bit app sometime.
Avatar of kh5395

ASKER

Thanks for your help