Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using "ntypes.h"

Posted on 1999-07-27
10
Medium Priority
?
443 Views
Last Modified: 2012-06-27
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.
0
Comment
Question by:kh5395
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
10 Comments
 
LVL 22

Expert Comment

by:cookre
ID: 1597692
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?

0
 

Author Comment

by:kh5395
ID: 1597693
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.
0
 
LVL 22

Expert Comment

by:cookre
ID: 1597694
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...
0
On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

 

Author Comment

by:kh5395
ID: 1597695
#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.
0
 

Author Comment

by:kh5395
ID: 1597696
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
0
 
LVL 22

Accepted Solution

by:
cookre earned 400 total points
ID: 1597697
You can put them in either place, and yes, the #pragma is the way MS VC is told to do 1 byte allignment.  That sort of thing will vary from compiler to compiler.

The new errrors you mentioned are caused by the linker being unable to find some subroutines you called.  Specifically, you made calls to NWDSGetAttrName and NWDSGetAttrCount and the linker couldn't find the code for them.

The errors will be cleared by including the appropriate .LIB files in your project.  Note that just as you provided a path to the NW header files, you can provide a path to the NW LIB files under the

Tools/Options
Directories tab
Show Directories for: Library Files

Which LIB files need to be included depends entirely upon which API calls you make.  Those particular references are in ...<SDKRoot>\lib\win32\mscvc\netwin32.lib.

Although you can frequently figure out which LIB a routine is in, it may help having a utility that can do the search for you.  One I've found to be of frequent value to me is SR - Search and Replace.  It's an exceptionaly useful tool for searching within files for a particular string.  If interested, check out:

www.funduc.com
0
 
LVL 22

Expert Comment

by:cookre
ID: 1597698
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.
0
 

Author Comment

by:kh5395
ID: 1597699
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
0
 
LVL 22

Expert Comment

by:cookre
ID: 1597700
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.
0
 

Author Comment

by:kh5395
ID: 1597701
Thanks for your help
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Files go missing when using DFS (Distributed File System) Replication and how to recover them and fix it.
This article covers the basics of data encryption, what it is, how it works, and why it's important. If you've ever wondered what goes on when you "encrypt" data, you can look here to build a good foundation for your personal learning.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

661 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question