473,387 Members | 1,575 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Building Compatible Libraries

From what I understand data alignment is not one of the things that has been
standardized. If this is true, then how are libraries constructed such that one
vendor's compiler can directly access aggregate data types such as <struct>
where these types were compiled using another vendor's compiler?
Jan 10 '07 #1
10 1226

Peter Olcott wrote:
From what I understand data alignment is not one of the things that has been
standardized. If this is true, then how are libraries constructed such that one
vendor's compiler can directly access aggregate data types such as <struct>
where these types were compiled using another vendor's compiler?
The standard says nothing about libraries.

Jan 10 '07 #2
Peter Olcott wrote:
From what I understand data alignment is not one of the things that has been
standardized. If this is true, then how are libraries constructed such that one
vendor's compiler can directly access aggregate data types such as <struct>
where these types were compiled using another vendor's compiler?
It does not.

This only works if the compiler vendors make their implementations
compatible.

One thing that is guarenteed is the order in which struct members a laid
out, but nothing about padding is guarenteed.

Having said all this, there are alot of implementations that follow the
same methodology as well as supporting things like #pragma pack or other
alignment control mechanisms.
Jan 10 '07 #3

"Noah Roberts" <ro**********@gmail.comwrote in message
news:11**********************@i39g2000hsf.googlegr oups.com...
>
Peter Olcott wrote:
>From what I understand data alignment is not one of the things that has been
standardized. If this is true, then how are libraries constructed such that
one
vendor's compiler can directly access aggregate data types such as <struct>
where these types were compiled using another vendor's compiler?

The standard says nothing about libraries.
Well then, how is this accomplished in real world practice?
Jan 10 '07 #4

Peter Olcott wrote:
"Noah Roberts" <ro**********@gmail.comwrote in message
news:11**********************@i39g2000hsf.googlegr oups.com...

Peter Olcott wrote:
From what I understand data alignment is not one of the things that has been
standardized. If this is true, then how are libraries constructed such that
one
vendor's compiler can directly access aggregate data types such as <struct>
where these types were compiled using another vendor's compiler?
The standard says nothing about libraries.

Well then, how is this accomplished in real world practice?
The target platform usually has some sort of spec for dynamic
libraries. There may be other specs to work from as well. In other
words, it's platform specific and not really guaranteed to work.

see http://mingw.sourceforge.net/mingwfaq.shtml#faq-msvcdll for example.

Jan 10 '07 #5
Peter Olcott wrote:
From what I understand data alignment is not one of the things that has been
standardized. If this is true, then how are libraries constructed such that one
vendor's compiler can directly access aggregate data types such as <struct>
where these types were compiled using another vendor's compiler?
Probably the only safe way is to keep types opaque and provide the
public interface as extern "C" functions.

--
Ian Collins.
Jan 11 '07 #6

"Ian Collins" <ia******@hotmail.comwrote in message
news:50*************@mid.individual.net...
Peter Olcott wrote:
>From what I understand data alignment is not one of the things that has been
standardized. If this is true, then how are libraries constructed such that
one
vendor's compiler can directly access aggregate data types such as <struct>
where these types were compiled using another vendor's compiler?
Probably the only safe way is to keep types opaque and provide the
public interface as extern "C" functions.

--
Ian Collins.
That is what I was thinking. This eliminates alignment differences and
differences in the derivation of the underlying naming conventions.
Jan 11 '07 #7

Peter Olcott wrote:
"Ian Collins" <ia******@hotmail.comwrote in message
news:50*************@mid.individual.net...
Peter Olcott wrote:
From what I understand data alignment is not one of the things that has been
standardized. If this is true, then how are libraries constructed such that
one
vendor's compiler can directly access aggregate data types such as <struct>
where these types were compiled using another vendor's compiler?
Probably the only safe way is to keep types opaque and provide the
public interface as extern "C" functions.

--
Ian Collins.

That is what I was thinking. This eliminates alignment differences and
differences in the derivation of the underlying naming conventions.
Oh, I think you're looking for specs like Corba or COM.

Jan 11 '07 #8

"Noah Roberts" <ro**********@gmail.comwrote in message
news:11**********************@k58g2000hse.googlegr oups.com...
>
Peter Olcott wrote:
>"Ian Collins" <ia******@hotmail.comwrote in message
news:50*************@mid.individual.net...
Peter Olcott wrote:
From what I understand data alignment is not one of the things that has
been
standardized. If this is true, then how are libraries constructed such
that
one
vendor's compiler can directly access aggregate data types such as
<struct>
where these types were compiled using another vendor's compiler?

Probably the only safe way is to keep types opaque and provide the
public interface as extern "C" functions.

--
Ian Collins.

That is what I was thinking. This eliminates alignment differences and
differences in the derivation of the underlying naming conventions.

Oh, I think you're looking for specs like Corba or COM.
For my purposes the prior suggestion will probably be optimal. I always try to
go with the simplest possible solution that completely solves the problem. Since
I am interfacing between C++ and a language following to "C" calling
conventions, the prior answer should work the best, and be entirely sufficient
for my needs.
Jan 11 '07 #9

Peter Olcott wrote:
"Noah Roberts" <ro**********@gmail.comwrote in message
news:11**********************@k58g2000hse.googlegr oups.com...

Peter Olcott wrote:
"Ian Collins" <ia******@hotmail.comwrote in message
news:50*************@mid.individual.net...
Peter Olcott wrote:
From what I understand data alignment is not one of the things that has
been
standardized. If this is true, then how are libraries constructed such
that
one
vendor's compiler can directly access aggregate data types such as
<struct>
where these types were compiled using another vendor's compiler?

Probably the only safe way is to keep types opaque and provide the
public interface as extern "C" functions.

--
Ian Collins.

That is what I was thinking. This eliminates alignment differences and
differences in the derivation of the underlying naming conventions.
Oh, I think you're looking for specs like Corba or COM.

For my purposes the prior suggestion will probably be optimal. I always try to
go with the simplest possible solution that completely solves the problem. Since
I am interfacing between C++ and a language following to "C" calling
conventions, the prior answer should work the best, and be entirely sufficient
for my needs.
I would at least look at those options and see if they meet your needs.
I've seen a lot of rather poor wheel "innovations".

Jan 11 '07 #10

"Noah Roberts" <ro**********@gmail.comwrote in message
news:11**********************@i39g2000hsf.googlegr oups.com...
>
Peter Olcott wrote:
>"Noah Roberts" <ro**********@gmail.comwrote in message
news:11**********************@k58g2000hse.googleg roups.com...
>
Peter Olcott wrote:
"Ian Collins" <ia******@hotmail.comwrote in message
news:50*************@mid.individual.net...
Peter Olcott wrote:
From what I understand data alignment is not one of the things that has
been
standardized. If this is true, then how are libraries constructed such
that
one
vendor's compiler can directly access aggregate data types such as
<struct>
where these types were compiled using another vendor's compiler?

Probably the only safe way is to keep types opaque and provide the
public interface as extern "C" functions.

--
Ian Collins.

That is what I was thinking. This eliminates alignment differences and
differences in the derivation of the underlying naming conventions.

Oh, I think you're looking for specs like Corba or COM.

For my purposes the prior suggestion will probably be optimal. I always try
to
go with the simplest possible solution that completely solves the problem.
Since
I am interfacing between C++ and a language following to "C" calling
conventions, the prior answer should work the best, and be entirely
sufficient
for my needs.

I would at least look at those options and see if they meet your needs.
I've seen a lot of rather poor wheel "innovations".
I am extensively looking at COM for another purpose. For this purpose I need
none of the baggage of COM.
Jan 11 '07 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Lee Gillie | last post by:
We have systems built upon shared libraries, which are maintained by a group of programmers. We install these to the GAC on production servers. For saftey, when a programmer uses one of these...
0
by: Lee Gillie | last post by:
We have systems built upon shared libraries, which are maintained by a group of programmers. We install these to the GAC on production servers. For saftey, when a programmer uses one of these...
7
by: Hal Vaughan | last post by:
I have a problem with port forwarding and I have been working on it for over 2 weeks with no luck. I have found C programs that almost work and Java programs that almost work, but nothing that...
13
by: treble54 | last post by:
I need to build PHP from source with the pdo_ibm extension and I am having an issue with it. Firstly, I am using Visual Studio .NET 2003 and I am building PHP from source through the Visual Studio...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.