|
-
September 12th, 2006, 06:12 AM
#1
Noob ask about ermmm using the same include file for multiple "objects" in C
I want to open 2 serial ports, one port to input data from a GPS device, another port to output the modified data to another computer.
But i got only one ibmcom3.c file(for on/off and setting up serial port), and this is C code, I cannot make c++ objects, i thought about writing another file say ibmcom3b.c by adding a prefix _b to all the functions and variables of ibmcom3.c, but that's a lot of work.
Is there a simpler way to do this?
The main code:
http://www.boondog.com/tutorials/gps/gps1_5.c
the ibmcom3.c file for serial link communication
http://www.boondog.com/tutorials/gps/ibmcom3.zip
Thanks in advance!
-
September 12th, 2006, 08:12 AM
#2
Re: Noob ask about ermmm using the same include file for multiple "objects" in C
On Windows, you'd create two separate DLLs that each include the ibmcom code - what platform are you using? If you can modify the IBM code, you could change it so that all the global variables are in a struct together, and a pointer to this struct is passed to every function, so you can have several different structs going at once, to allow you to access multiple ports.
-
September 14th, 2006, 11:20 PM
#3
Re: Noob ask about ermmm using the same include file for multiple "objects" in C
Thank you very much! Great help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|