Hi,
I don't know if it is better to post this question to a C or C++
group, so my apologies.
My general question:
I have a very big C++ program (Main.cpp) which compiles on machine X
with compiler XA++.
I also have a function whose source code (function.c) in C (not C++)
compiles on machine X with compiler XBcc.
XA++ and XBcc are compilers from different companies.
On machine Y I can do:
1- compilation of Main.cpp to object file Main.o using compiler Y++
2- compilation of function.c to objetc file function.o using compiler
Ycc
Compilers Y++ and Ycc come from the same company. "Y" could be for
instance the GNU compiler so we would have g++ and gcc.
3- Main.o sends input data to function.o and function.o returns
calculated data to Main.o. Now I link in some way Main.o with
function.o and create Program_in_Y.exe.
My general question is if I can do the same procedure in machine X.
Perhaps the same question is if objects created with different
compilers on the same machine can link in some way and create an
executable or binary file.
Thanks. 16 2825
On May 19, 4:02 am, horacius....@gmail.com wrote:
Hi,
I don't know if it is better to post this question to a C or C++
group, so my apologies.
My general question:
I have a very big C++ program (Main.cpp) which compiles on machine X
with compiler XA++.
I also have a function whose source code (function.c) in C (not C++)
compiles on machine X with compiler XBcc.
XA++ and XBcc are compilers from different companies.
On machine Y I can do:
1- compilation of Main.cpp to object file Main.o using compiler Y++
2- compilation of function.c to objetc file function.o using compiler
Ycc
Compilers Y++ and Ycc come from the same company. "Y" could be for
instance the GNU compiler so we would have g++ and gcc.
3- Main.o sends input data to function.o and function.o returns
calculated data to Main.o. Now I link in some way Main.o with
function.o and create Program_in_Y.exe.
My general question is if I can do the same procedure in machine X.
Perhaps the same question is if objects created with different
compilers on the same machine can link in some way and create an
executable or binary file.
Thanks.
On May 19, 1:40 pm, popy...@gmail.com wrote:
On May 19, 4:02 am, horacius....@gmail.com wrote:
Hi,
I don't know if it is better to post this question to a C or C++
group, so my apologies.
My general question:
I have a very big C++ program (Main.cpp) which compiles on machine X
with compiler XA++.
I also have a function whose source code (function.c) in C (not C++)
compiles on machine X with compiler XBcc.
XA++ and XBcc are compilers from different companies.
........
3- Main.o sends input data to function.o and function.o returns
calculated data to Main.o. Now I link in some way Main.o with
function.o and create Program_in_Y.exe.
My general question is if I can do the same procedure in machine X.
Perhaps the same question is if objects created with different
compilers on the same machine can link in some way and create an
executable or binary file.
Technically if both compilers produce same object format that
can link, only problem that remains is calling convention.
You can see if you can specify calling convention of interfacing
functions explicitelly. Another problem is, as if compilers don;t
have compatible calling conventions at all.
Then you are out of luck, as then you have to write thunks in
assembler that will forward parameters
and result between functions.
And of course you have to make sure that layout for parameters
and results match. eg long double for one compiler can be
64 bit and for other 80 bit, not to mention structs.
All in all tough luck. If you are not experienced in assembler
programming then it is easier to just compile both Main.cpp and
function.c (with possible corrections) with XA++.
Greetings, Branimir.
On 19 Mai, 18:02, horacius....@gmail.com wrote:
Hi,
I don't know if it is better to post this question to a C or C++
group, so my apologies.
My general question:
I have a very big C++ program (Main.cpp) which compiles on machine X
with compiler XA++.
I also have a function whose source code (function.c) in C (not C++)
compiles on machine X with compiler XBcc.
XA++ and XBcc are compilers from different companies.
On machine Y I can do:
1- compilation of Main.cpp to object file Main.o using compiler Y++
2- compilation of function.c to objetc file function.o using compiler
Ycc
Compilers Y++ and Ycc come from the same company. "Y" could be for
instance the GNU compiler so we would have g++ and gcc.
3- Main.o sends input data to function.o and function.o returns
calculated data to Main.o. Now I link in some way Main.o with
function.o and create Program_in_Y.exe.
My general question is if I can do the same procedure in machine X.
Perhaps the same question is if objects created with different
compilers on the same machine can link in some way and create an
executable or binary file.
Thanks.
Ah, a good homework question!
Normally every platform has a ABI which tells how to pass parameters
to a function etc.
If the compiler A obeys to this ABI and compiler 'B' does not you have
a problem otherwise
it might work (if the runtime functions are also compatible). You
might also have different
identifier names like preceding underscores.
For more information please use the references in the books list your
teacher gave you.
"Branimir Maksimovic" <bm***@hotmail.comwrote in message
news:11*********************@k79g2000hse.googlegro ups.com...
On May 19, 1:40 pm, popy...@gmail.com wrote:
>On May 19, 4:02 am, horacius....@gmail.com wrote:
Hi,
I don't know if it is better to post this question to a C or C++
group, so my apologies.
My general question:
I have a very big C++ program (Main.cpp) which compiles on machine X
with compiler XA++.
I also have a function whose source code (function.c) in C (not C++)
compiles on machine X with compiler XBcc.
XA++ and XBcc are compilers from different companies.
.......
3- Main.o sends input data to function.o and function.o returns
calculated data to Main.o. Now I link in some way Main.o with
function.o and create Program_in_Y.exe.
My general question is if I can do the same procedure in machine X.
Perhaps the same question is if objects created with different
compilers on the same machine can link in some way and create an
executable or binary file.
Technically if both compilers produce same object format that
can link, only problem that remains is calling convention.
You can see if you can specify calling convention of interfacing
functions explicitelly. Another problem is, as if compilers don;t
have compatible calling conventions at all.
Then you are out of luck, as then you have to write thunks in
assembler that will forward parameters
and result between functions.
And of course you have to make sure that layout for parameters
and results match. eg long double for one compiler can be
64 bit and for other 80 bit, not to mention structs.
All in all tough luck. If you are not experienced in assembler
programming then it is easier to just compile both Main.cpp and
function.c (with possible corrections) with XA++.
Greetings, Branimir.
<OT>
"just compile both Main.cpp and
function.c (with possible corrections) with XA++"
This is probably the best guess solution. But you
can omit the corrections part if the compiler is also
a C compiler and the code is actually C.
This discussion is completely off topic for clc. So if you
really want an answer you should look at the documentation
for the compilers you plan to use.
</OT>
On May 19, 3:10 pm, "Barry" <bar...@nullhighstream.netwrote:
"Branimir Maksimovic" <b...@hotmail.comwrote in message
news:11*********************@k79g2000hse.googlegro ups.com...
On May 19, 1:40 pm, popy...@gmail.com wrote:
On May 19, 4:02 am, horacius....@gmail.com wrote:
Hi,
I don't know if it is better to post this question to a C or C++
group, so my apologies.
My general question:
I have a very big C++ program (Main.cpp) which compiles on machine X
with compiler XA++.
I also have a function whose source code (function.c) in C (not C++)
compiles on machine X with compiler XBcc.
XA++ and XBcc are compilers from different companies.
.......
3- Main.o sends input data to function.o and function.o returns
calculated data to Main.o. Now I link in some way Main.o with
function.o and create Program_in_Y.exe.
My general question is if I can do the same procedure in machine X.
Perhaps the same question is if objects created with different
compilers on the same machine can link in some way and create an
executable or binary file.
Technically if both compilers produce same object format that
can link, only problem that remains is calling convention.
You can see if you can specify calling convention of interfacing
functions explicitelly. Another problem is, as if compilers don;t
have compatible calling conventions at all.
Then you are out of luck, as then you have to write thunks in
assembler that will forward parameters
and result between functions.
And of course you have to make sure that layout for parameters
and results match. eg long double for one compiler can be
64 bit and for other 80 bit, not to mention structs.
All in all tough luck. If you are not experienced in assembler
programming then it is easier to just compile both Main.cpp and
function.c (with possible corrections) with XA++.
Greetings, Branimir.
<OT>
"just compile both Main.cpp and
function.c (with possible corrections) with XA++"
This is probably the best guess solution. But you
can omit the corrections part if the compiler is also
a C compiler and the code is actually C.
This reminds why is bad to answer messages that are
crossposted ;)
>
This discussion is completely off topic for clc. So if you
really want an answer you should look at the documentation
for the compilers you plan to use.
I guess OP already did that, but yet he/she don;t knows the answer.
OTOH this naive question, speaks that either OP is totally
clueless or is perfect troll ;)
Greetings, Branimir.
<ho**********@gmail.comwrote in message
news:11**********************@q75g2000hsh.googlegr oups.com...
Hi,
I don't know if it is better to post this question to a C or C++
group, so my apologies.
My general question:
I have a very big C++ program (Main.cpp) which compiles on machine X
with compiler XA++.
I also have a function whose source code (function.c) in C (not C++)
compiles on machine X with compiler XBcc.
XA++ and XBcc are compilers from different companies.
On machine Y I can do:
1- compilation of Main.cpp to object file Main.o using compiler Y++
2- compilation of function.c to objetc file function.o using compiler
Ycc
Compilers Y++ and Ycc come from the same company. "Y" could be for
instance the GNU compiler so we would have g++ and gcc.
3- Main.o sends input data to function.o and function.o returns
calculated data to Main.o. Now I link in some way Main.o with
function.o and create Program_in_Y.exe.
My general question is if I can do the same procedure in machine X.
Perhaps the same question is if objects created with different
compilers on the same machine can link in some way and create an
executable or binary file.
There is no gaurentee you can do this with arbitary comilers, though in
practice its often possible. Consider the case for machines where there is
no natural stack, e.g. IBM370. Even of both implementations use the same
register as the stack pointer, one could build the stack from low memory up,
another from high memory down....
Thanks. ho**********@gmail.com schrieb:
Hi,
I don't know if it is better to post this question to a C or C++
group, so my apologies.
To a platform specific or compiler specific newsgroup.
My general question:
I have a very big C++ program (Main.cpp) which compiles on machine X
with compiler XA++.
I also have a function whose source code (function.c) in C (not C++)
compiles on machine X with compiler XBcc.
XA++ and XBcc are compilers from different companies.
In general, object files from two different compilers from two different
companies don't link together.
Why didn't you try if compiler Y can compile for your platform X also? If
it is GNU g++/gcc, if can compile for many platforms.
--
Thomas http://www.netmeister.org/news/learn2quote.html ho**********@gmail.com wrote:
Hi,
I don't know if it is better to post this question to a C or C++
group, so my apologies.
My general question:
I have a very big C++ program (Main.cpp) which compiles on machine X
with compiler XA++.
I also have a function whose source code (function.c) in C (not C++)
compiles on machine X with compiler XBcc.
XA++ and XBcc are compilers from different companies.
On machine Y I can do:
1- compilation of Main.cpp to object file Main.o using compiler Y++
2- compilation of function.c to objetc file function.o using compiler
Ycc
Compilers Y++ and Ycc come from the same company. "Y" could be for
instance the GNU compiler so we would have g++ and gcc.
3- Main.o sends input data to function.o and function.o returns
calculated data to Main.o. Now I link in some way Main.o with
function.o and create Program_in_Y.exe.
My general question is if I can do the same procedure in machine X.
Perhaps the same question is if objects created with different
compilers on the same machine can link in some way and create an
executable or binary file.
Provided the C functions are declared as extern "C" to the C++ code, you
shouldn't have a problem. It is standard practice for all native C
compilers to use the came calling conventions on a particular machine.
A C compiler that didn't would be next to useless as it wouldn't be able
to generate code that used the native libraries.
--
Ian Collins.
Ian Collins wrote:
It is standard practice for all native C compilers to use the came
calling conventions on a particular machine. A C compiler that didn't
would be next to useless as it wouldn't be able to generate code that
used the native libraries.
One might think so, but I know of at least one counterexample, and it
certainly wouldn't surprise me if there were others.
The Win32 API contains no function that returns a floating-point value,
so no convention arose about how to do that. Given the following,
double foo( void );
double result;
result = foo();
the returned value is handled by Microsoft Visual C++ and Watcom 10.0
in different ways.
MSVC: call foo
fstp result ; pop ST(0) into result
Watcom: call foo
mov result, eax ; move edx:eax into result
mov result+4, edx
- Ernie http://home.comcast.net/~erniew
Ernie Wright wrote:
Ian Collins wrote:
>It is standard practice for all native C compilers to use the came calling conventions on a particular machine. A C compiler that didn't would be next to useless as it wouldn't be able to generate code that used the native libraries.
One might think so, but I know of at least one counterexample, and it
certainly wouldn't surprise me if there were others.
The Win32 API contains no function that returns a floating-point value,
so no convention arose about how to do that. Given the following,
So what about strtod() and friends?
--
Ian Collins. po*****@gmail.com wrote:
On May 19, 4:02 am, horacius....@gmail.com wrote:
.... snip and jumping in. This is to horacius.
>> I have a very big C++ program (Main.cpp) which compiles on machine X with compiler XA++.
I also have a function whose source code (function.c) in C (not C++) compiles on machine X with compiler XBcc.
XA++ and XBcc are compilers from different companies.
On machine Y I can do:
1- compilation of Main.cpp to object file Main.o using compiler Y++ 2- compilation of function.c to objetc file function.o using compiler Ycc
Compilers Y++ and Ycc come from the same company. "Y" could be for instance the GNU compiler so we would have g++ and gcc.
3- Main.o sends input data to function.o and function.o returns calculated data to Main.o. Now I link in some way Main.o with function.o and create Program_in_Y.exe.
My general question is if I can do the same procedure in machine X. Perhaps the same question is if objects created with different compilers on the same machine can link in some way and create an executable or binary file.
This is really a C++ question, and should be answered on
comp.lang.c++. However the secret is in the use of __cplusplus__
in the header file for function.c. However you also need to check
the documentation of your compilers.
--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
<http://kadaitcha.cx/vista/dogsbreakfast/index.html>
cbfalconer at maineline dot net
--
Posted via a free Usenet account from http://www.teranews.com
CBFalconer <cb********@yahoo.comwrites:
[...]
This is really a C++ question, and should be answered on
comp.lang.c++. However the secret is in the use of __cplusplus__
in the header file for function.c. However you also need to check
the documentation of your compilers.
It's __cplusplus, not __cplusplus__.
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Ian Collins wrote:
Ernie Wright wrote:
>> The Win32 API contains no function that returns a floating-point value, so no convention arose about how to do that.
So what about strtod() and friends?
Not sure what you're asking. They aren't part of the Win32 API.
In general, compilers for Windows provide their own C runtime libraries.
It'd be pretty unusual for code compiled by X to be linked to Y's
runtime, and I wouldn't automatically assume that it could be done.
- Ernie http://home.comcast.net/~erniew
Ernie Wright wrote:
Ian Collins wrote:
>Ernie Wright wrote:
>>> The Win32 API contains no function that returns a floating-point value, so no convention arose about how to do that.
So what about strtod() and friends?
Not sure what you're asking. They aren't part of the Win32 API.
In general, compilers for Windows provide their own C runtime libraries.
It'd be pretty unusual for code compiled by X to be linked to Y's
runtime, and I wouldn't automatically assume that it could be done.
I see. I didn't realise that, I'm used to operating systems which have
their own standard libraries.
--
Ian Collins. ho**********@gmail.com wrote:
I have a very big C++ program (Main.cpp) which compiles on machine X
with compiler XA++.
I also have a function whose source code (function.c) in C (not C++)
compiles on machine X with compiler XBcc.
XA++ and XBcc are compilers from different companies.
Does XA++ have a C mode for compiling?
--
Thad
Doing some investigation I checked that using GNU compiler for C++ and
C with function wrappers, this is feasible.
Thanks.
On 19 mayo, 13:02, horacius....@gmail.com wrote:
Hi,
I don't know if it is better to post this question to a C or C++
group, so my apologies.
My general question:
I have a very big C++ program (Main.cpp) which compiles on machine X
with compiler XA++.
I also have a function whose source code (function.c) in C (not C++)
compiles on machine X with compiler XBcc.
XA++ and XBcc are compilers from different companies.
On machine Y I can do:
1- compilation of Main.cpp to object file Main.o using compiler Y++
2- compilation of function.c to objetc file function.o using compiler
Ycc
Compilers Y++ and Ycc come from the same company. "Y" could be for
instance the GNU compiler so we would have g++ and gcc.
3- Main.o sends input data to function.o and function.o returns
calculated data to Main.o. Now I link in some way Main.o with
function.o and create Program_in_Y.exe.
My general question is if I can do the same procedure in machine X.
Perhaps the same question is if objects created with different
compilers on the same machine can link in some way and create an
executable or binary file.
Thanks.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Michael Strorm |
last post by:
Hi!
I posted a message a while back asking for project suggestions, and decided
to go with the idea of creating an adventure game (although it was never
intended to be a 'proper' game, rather an...
|
by: Martin |
last post by:
Hello,
I'm new with triggers and I can not find any good example on how to
do the following:
I have two tables WO and PM with the following fields:
WO.WONUM, VARCHAR(10)
WO.PMNUM,...
|
by: adi |
last post by:
Hi all,
Hope there is a quick fix for this:
I am inserting data from one table to another on the same DB. The
insert is pretty simple as in:
insert into datatable(field1, field2, field3)...
|
by: terpatwork |
last post by:
Hi,
(1) I have an access form that allows users to enter data, and when
they click a button, the OnClick code that I've written uses a SQL
INSERT statement to insert the data into the database. I...
|
by: zerro |
last post by:
Hello,
I try to understand heap overflows (under Linux), but can not understand
one
thing with freeing memory allocated with malloc(). Here it comes:
I have a program called 1.c:
main() {...
|
by: dragoncoder |
last post by:
Hello all,
I have the following code. Plesae have a look.
#include <iostream>
#include <string>
#include <map>
#include <cstdlib>
using namespace std;
|
by: mirandacascade |
last post by:
O/S: Win2K
Vsn of Python: 2.4
Example:
<a>
<b createAnotherWhenCondition="x">
<c>text for c</c>
<d>text for d</d>
</b>
|
by: horacius.rex |
last post by:
Hi,
I don't know if it is better to post this question to a C or C++
group, so my apologies.
My general question:
I have a very big C++ program (Main.cpp) which compiles on machine X
with...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |