6 Replies - 15729 Views - Last Post: 11 August 2010 - 10:43 PM Rate Topic: -----

#1 asadfx   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 16-January 09

adding user defined function to the library

Post icon  Posted 16 January 2009 - 01:37 AM

friends,
I use a IDE called quincy 2005 and the compiler is MinGW GCC. I want to add user defined functions to the library.
I have created .o files for the functions. But I am not sure what tools to use for GCC. I am using Vista.

Bye.
Is This A Good Question/Topic? 0
  • +

Replies To: adding user defined function to the library

#2 Linkowiezi   User is offline

  • D.I.C Regular

Reputation: 58
  • View blog
  • Posts: 316
  • Joined: 07-October 08

Re: adding user defined function to the library

Posted 16 January 2009 - 03:01 AM

Do you want to add new functions to the quinchy program itself or
do you want to place your functions in the IDE's header library?
Was This Post Helpful? 0
  • +
  • -

#3 sakshi_gb   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 11-March 09

Re: adding user defined function to the library

Posted 16 March 2009 - 11:49 PM

hi,

I want to add my own user defined functoin to the standard library. What are the steps?
Was This Post Helpful? 0
  • +
  • -

#4 Linkowiezi   User is offline

  • D.I.C Regular

Reputation: 58
  • View blog
  • Posts: 316
  • Joined: 07-October 08

Re: adding user defined function to the library

Posted 17 March 2009 - 12:27 AM

Well... to actually add it to the 'standard library' I guess you will have to apply for it to be accepted into the standard library.

But, my guess is that's not really what you want.
What I think you want is to put your headers in MinGW's include folder.
That way you will be able to do this: #include <myHeader.h>.
And not having to have your file in every program folder.
But this can cause trouble tough if you want to share your program with someone else. Because you have to go into this folder and send them this file also. And they have to put it in their default include folder or change a little in your code.

Hope this was what you were looking for. :)
Was This Post Helpful? 0
  • +
  • -

#5 zero_cool1   User is offline

  • New D.I.C Head

Reputation: 8
  • View blog
  • Posts: 32
  • Joined: 25-January 10

Re: adding user defined function to the library

Posted 14 February 2010 - 11:11 AM

View PostLinkowiezi, on 16 March 2009 - 11:27 PM, said:

Well... to actually add it to the 'standard library' I guess you will have to apply for it to be accepted into the standard library.

But, my guess is that's not really what you want.
What I think you want is to put your headers in MinGW's include folder.
That way you will be able to do this: #include <myHeader.h>.
And not having to have your file in every program folder.
But this can cause trouble tough if you want to share your program with someone else. Because you have to go into this folder and send them this file also. And they have to put it in their default include folder or change a little in your code.

Hope this was what you were looking for. :)

Hi!
well I would like to know how exactly I can add a function to my standard header files.
Could you please guide me through series of steps?
Thanks
Was This Post Helpful? 0
  • +
  • -

#6 Aphex19   User is offline

  • Born again Pastafarian.
  • member icon

Reputation: 619
  • View blog
  • Posts: 1,873
  • Joined: 02-August 09

Re: adding user defined function to the library

Posted 14 February 2010 - 01:03 PM

You want to create a dynamic link library? It sounds like thats what you want to do. Using a dynamic link library, you can define functions in a seperate file (ie, a DLL file) and then call them dynamically by using function pointers and other methods of linking.
Was This Post Helpful? 0
  • +
  • -

#7 Guest_pushpendra patidar*


Reputation:

Re: adding user defined function to the library

Posted 11 August 2010 - 10:43 PM

it's simple.....

just have ur function definition in one Cpp or C file.....ie save it as .cpp or .C file....
then include the file as #include "program.c"
and then wherever you need call that functionin an another program...
for example:
let me add my own ADDITION function in my library.....

this is my first file stored in .C....
int add(int a,int B)/>
{
int c;
c=a+b;
return c;
}
the file name for the above is  add.c

then am opening my main program file in .c mode ....
#include<stdio.h>
#include<conio.h>
#include"add.c"
void main()
{
int a,b,c;
scanf("%d%d",&a,&B)/>;
c=add(a,B)/>;
printf("\n the added sum is :%d",c);
getch();
}




thank u
Was This Post Helpful? 0

Page 1 of 1