March 28, 2024, 10:49:24 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


C++ lib and Aurora

Started by Rock Ridge Farm (Larry), December 20, 2006, 06:20:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Rock Ridge Farm (Larry)

Can I use libraries built with vc6 with Aurora?
How would I do that.
I have a lib I built with vc6 and would like to call it from an Aurora function.
Is this possible?

J B Wood (Zumwalt)

yes it is, you have to make your methods exportable in your library, personally I have not done it, but those exports are what I use for the cdecl calls

Shannara

Ooo, any example of this? If I can find an example, I might be able to modify the AngelScript source's output (which is .lib) to be Aurora compatible.
Love is staying up all night with a sick child, or a healthy adult.

J B Wood (Zumwalt)

Looking around, I got something around here....(in my computer that is, hiding in the cracks of the datachannels)

Zen

Sync.

I have re-compiled AngelScript as a DLL with visual studio 2005 and I am attempting to get it to work with Aurora.

I will let you know if I get anything ;)

Lewis

Shannara

You too, eh? Cool beans. This should be interesting.
Love is staying up all night with a sick child, or a healthy adult.

Zen

Yeah me too. I am just converting all the class definitions over... ZzZz ZzZz ZzZz

Lewis

Shannara

Im crossing my fingers that there are no interface differences when compiling between VS2005 and VS6. As the later are installed on most machines nowdays ... but come to think of it. .NET 2005 is an optional download for WinXP, and requires for Win2k3, isnt it?
Love is staying up all night with a sick child, or a healthy adult.

Zen

Well it compiled fine first time on VS .Net 2005 as a DLL and a static lib. If you can't get it to work I will e-mail you the DLL.

Lewis

Shannara

Im at work right now, no fair :) I compiled it about two nights (?) ago, was mentioned in the other post. Under VC6, it compiled perfectly :) I was working on the interface that night until 2AM, until I realized I had to work later that morning.
Love is staying up all night with a sick child, or a healthy adult.

Rock Ridge Farm (Larry)

I am still at a loss - I have the aurora code to call the v6 lib routines - where do I put the v6 lib so aurora can find it
and what do I name it?
Does it need to be re-compiled as a dll??

Parker

First off you'll have to use the C interface, because Aurora classes aren't compatible with C++ classes (which C++ compiler? VC5? VC6? GCC? [then which GCC?]) which is pretty impossible as they're all incompatible from each other ;)

Second, it may take some work because Aurora doesn't use the same C library that C compilers do. You may be able to get away with linking in VC6's crtdll.lib though with your program.

Third, I'm not sure whose lib file formats Aurora is and is not compatible with. Paul will have to answer that.

Good luck ;D
Parker

Ionic Wind Support Team

#use "yourlib.lib" and put the lib in your Aurora 'libs' durectory.

I link to VC6 libs for the browser control.  It was easier to write the event sink in C++ and create a static library.

It all depends on what you are trying to do.  If you are using a lot of low level C routines then you can use the crtdll.lib from Emergence which is slightly different then Aurora's.   If you are using C++ classes you will need to wrap those classes in CDECL functions, passing pointers back and forth.

Aurora's VTABLE is the same as C++ so you can technically use a C++ class returned as a pointer, haven't tried it yet though.

All C compilers add an underscore to function names when they stick them in a static libraries.  An old holdover from days gone by that they refuse to changed.  In anyevent if your function in C is:

int SomeFunction(int a);

then in Aurora it would be:

DECLARE CDECL EXTERN _SomeFunction(int a),int;

When linking with a static library.  If you are using a static library from someone else, and they are using STDCALL functions then it gets a bit more complicated.  STDCALL functions from a C compiler contain a bit of name mangling to list the number of parameter bytes.  So a defintion in C:

int stdcall SomeFunction(int a);

Becomes:

DECLARE EXTERN _SomeFunction@4(int a),int;

In Aurora.  Don't blame me, that is how C compiler are designed.

If you have access to the source code you are really better doing a port to Aurora as in the end it will save you a lot of headaches.  Aurora's syntax structure is close enough to C/C++ that I normally chose a port over a link ;)

If you are using a DLL then that is different.  DLL function names don't get mangled or have a leading underscore, regardless of the compiler.  Much easier to use that way.

Paul.
Ionic Wind Support Team

Rock Ridge Farm (Larry)

I have the source but not the time.
Would be glad to send it to you :)