Home » Infrastructure » Unix » .DEF file in HP-UX Shell scripting
.DEF file in HP-UX Shell scripting [message #215955] Wed, 24 January 2007 07:18 Go to next message
frank.svs
Messages: 162
Registered: February 2006
Senior Member
Hi Pals,

I need some information related .DEF file in HP-Ux shell scripting. What actaully a .DEF file contains. It is having all definitions of some functions. But what is the relationship between a .def file and shell script. Can anyone give some examples.


Thanks in Advance.

Best Regards,
frank
Re: .DEF file in HP-UX Shell scripting [message #215979 is a reply to message #215955] Wed, 24 January 2007 09:01 Go to previous messageGo to next message
tahpush
Messages: 961
Registered: August 2006
Location: Stockholm/Sweden
Senior Member

Hmm tricky one dont know if this is any help to you but...her goes
makedef

The makedef utility is a Bourne shell script provided to compile Windows specific ".def" files. The utility generates a C++ module that has to be compiled and linked into your shared library in order to make it loadable using the Windows LoadLibrary() and GetProcAddress() functions. You can use C preprocessor statements (e.g. #include, #if, #ifdef, #else, #endif) to make makedef conditionally parse blocks of the DEF file.

Usage:

makedef [-RCTAB] [-D<string>] [-U<string>] [-E<entrypoint>] [-I<includepath>] def_file output_file

Parameters:

*

-RCTAB: If you want to compile a message file into your shared library, you also need a .def file. -RCTAB is used to tell makedef to include a global symbol, the resource table generated by the tool coolmc (described below), into your share library.
*

-D<string>: Use -D to specify a string that will be passed as conditional compile flag to the preprocessor by the makedef utility.
*

-U<string>: Use -U to undefine a flag for the preprocessor.
*

-E<entrypoint>: Use -E to define the main entry point function into your shared library. This function will be called in order to initialize the shared library after loading.
*

-I<includepath>: Use -I to define an additional directory where your include files can be found.
*

def_file: Path and name of the DEF file to process.
*

output_file: Path and name of the output file to be created (by default it is <file_name>_def.cxx).
Re: .DEF file in HP-UX Shell scripting [message #216007 is a reply to message #215979] Wed, 24 January 2007 10:38 Go to previous messageGo to next message
frank.svs
Messages: 162
Registered: February 2006
Senior Member


Thanks buddy.
Re: .DEF file in HP-UX Shell scripting [message #216113 is a reply to message #216007] Thu, 25 January 2007 01:16 Go to previous messageGo to next message
tahpush
Messages: 961
Registered: August 2006
Location: Stockholm/Sweden
Senior Member

Glad it helped Smile
Re: .DEF file in HP-UX Shell scripting [message #216117 is a reply to message #216113] Thu, 25 January 2007 01:27 Go to previous messageGo to next message
frank.svs
Messages: 162
Registered: February 2006
Senior Member
But this is my actual requirement.


Hi pals,

This is what i am looking for actaully. I have two file in my dir. One is "sample" which is an executable file and one is file which is containing all definitions (i.e Functions and var's). Now i am working Ksh and my requirement is that, i need to able to make use of functions defined in .def file, in my actaul executable file i.e "Sample" but i am not getting. Can anyone please help me out.

Here is what i have done.

$cat sample
echo $(a)
echo $(b)
test1
test2


$cat source.def
################################################################################
#
# NAME: SOURCE_DEFINITIONS.DEF
#
################################################################################


typeset a=10
typeset b=20

test1()
{
echo "****** I am in Test-1 *****"
}
test2()
{
echo "****** I am in Test-2 *****"
}


$pwd
/home/manu/quest
$ls
sample source.def
$
$ksh
$ ls -l sample
-rwxrwxr-x 1 maheshv manu 34 Jan 25 12:46 sample
$
$ ./sample
./sample: line 1: a: command not found

./sample: line 2: b: command not found

./sample: line 3: test1: command not found
./sample: line 4: test2: command not found
$
$

$sample

Regards,
franky





Re: .DEF file in HP-UX Shell scripting [message #216201 is a reply to message #216117] Thu, 25 January 2007 09:56 Go to previous messageGo to next message
tahpush
Messages: 961
Registered: August 2006
Location: Stockholm/Sweden
Senior Member

[/export/home/omwb/script]
cat functest.def
################################################################################
#
# NAME: SOURCE_DEFINITIONS.DEF
#
################################################################################


typeset a=10
typeset b=20

test1()
{
echo "****** I am in Test-1 *****"
}
test2()
{
echo "****** I am in Test-2 *****"
}

[/export/home/omwb/script]
cat sample
. /export/home/omwb/script/functest.def
echo ${a}
echo ${b}
test1
test2

[/export/home/omwb/script]
. sample
10
20
****** I am in Test-1 *****
****** I am in Test-2 *****

I include the path to .def file ,and added { } instead of ( )
for the variables
Re: .DEF file in HP-UX Shell scripting [message #216721 is a reply to message #216201] Tue, 30 January 2007 02:45 Go to previous messageGo to next message
tahpush
Messages: 961
Registered: August 2006
Location: Stockholm/Sweden
Senior Member

Did it sort you out ?
Or did I missinterput your question ?
Re: .DEF file in HP-UX Shell scripting [message #217297 is a reply to message #216721] Thu, 01 February 2007 09:45 Go to previous message
frank.svs
Messages: 162
Registered: February 2006
Senior Member
Thank you very much guys it worked out very well.
Previous Topic: Date Comparision
Next Topic: xwindows
Goto Forum:
  


Current Time: Mon Nov 25 02:34:55 CST 2024