Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 5th, 2004, 1:23 PM   #1
Frenchy
Newbie
 
Join Date: Aug 2004
Posts: 10
Rep Power: 0 Frenchy is on a distinguished road
how i know if i have a library compatible with DEV-C++, sometimes i use te tool reimport to convert microsoft obj library to library.a (format for DEV-C++)

but i 'd like to know if the result is good..?? :huh:

Frenchy
Frenchy is offline   Reply With Quote
Old Aug 5th, 2004, 1:44 PM   #2
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
I don't know the answer, but welcome to the forums!
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Aug 5th, 2004, 3:37 PM   #3
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Although I have not done this personally... I can almost guarantee that the conversion from MS object code to any other via any tool, be it import or a third party app will not turn out very stable. The primary reason is that MS is proprietary and the MS object may reference components that are not known to a "foreign" compiler.

Someone else may be able to shed more light on the details for you.

Welcome to the forums!
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Aug 7th, 2004, 12:57 AM   #4
kurifu
Expert Programmer
 
kurifu's Avatar
 
Join Date: Jul 2004
Location: Halifax, Nova Scotia (Canada)
Posts: 784
Rep Power: 5 kurifu is on a distinguished road
Send a message via ICQ to kurifu Send a message via MSN to kurifu
MS's libraries (in C and C++ anyway) used a format called COFF. *.a format uses ELF (or does it? actually it may use the pre-elf old school UNIX/Linux format... but beside the point).

The formats should be able to import from MS's library format to the .a format SO LONG AS the functions being exported from MS's format contain functions that are not mangled... actually even mangled function should be exportable, they will probably just be uncallable by normal means.

C++ exported classes and functions will probably not import. Usually there is a verbose mode which will tell you when something will import or not. Just check the exported tables when you are done, make sure everything you needed is actually there. You will get unresolved externals otherwise when trying to link your code.
__________________
Clifford Matthew Roche <geek@cliffordroche.com>
Web Hosting: http://www.crd-hosting.com
Consulting: http://www.crdev-consulting.com
kurifu is offline   Reply With Quote
Old Aug 7th, 2004, 3:47 AM   #5
Frenchy
Newbie
 
Join Date: Aug 2004
Posts: 10
Rep Power: 0 Frenchy is on a distinguished road
thanks for your msg of welcome...

hum....
i am afraid the library what i want to use contains what you cll "mangled name"..

so i cant use tools to import DLL or to create importation lib format DEVC++ (DLLtool is a good example)

Quote:

LIBRARY SkunkCmp.dll
EXPORTS
??0CCat@@QAE@XZ
??0CChunkFile@@QAE@XZ
??1CCat@@QAE@XZ
??1CChunkFile@@QAE@XZ
??4CCat@@QAEAAV0@ABV0@@Z
??4CChunkFile@@QAEAAV0@ABV0@@Z
?AddChunk@CChunkFile@@QAEHKKPAXKH@Z
?CheckChunkFileSize@CChunkFile@@IAEHK@Z
?Close@CCat@@QAEXXZ
?Close@CChunkFile@@QAEXXZ
?ExpandFile@CCat@@SAHPAD0@Z
?ExtendFileSize@CChunkFile@@IAEHK@Z
?FindChunk@CChunkFile@@IAEPAUCHUNKREC@@KK@Z
?FreeAll@CCat@@QAEXXZ
?FreeFile@CCat@@IAEHPAUFILEHDR@@@Z
?FreeFile@CCat@@QAEHH@Z
?FreeFile@CCat@@QAEHPAD@Z
?GetCurrentFileSize@CChunkFile@@IAEKXZ
?GetFileCount@CCat@@QAEHXZ
?GetFileHdr@CCat@@IAEPAUFILEHDR@@H@Z
?Open@CCat@@QAEHPAD@Z
?Open@CChunkFile@@QAEHPADHK@Z
but that question so:

i if use VC++ how i can create an import lib from a DLL which already exist?? (in fact no available source).. with dev-C++ i use Dlltool but is there a tool as Dlltool to create a .lib ??
Frenchy is offline   Reply With Quote
Old Aug 7th, 2004, 12:54 PM   #6
kurifu
Expert Programmer
 
kurifu's Avatar
 
Join Date: Jul 2004
Location: Halifax, Nova Scotia (Canada)
Posts: 784
Rep Power: 5 kurifu is on a distinguished road
Send a message via ICQ to kurifu Send a message via MSN to kurifu
There is a way to do this.. but it is much more difficult.

What you need to do is create a project with VC++ which links to the DLL you are trying to export and creates a C style interface. It is not that difficult to do, though it is difficult to explain.

Lets say you have a class

class Foo1 { ... } exported from your MSVC DLL or Library, you will need to create a new project which links to the library and does the following:

extern "C" {
 __declspec( export ) void* CreateObject( );
 __declspec( export ) void DestroyObject( );

 __declspec( export ) int ThisWrapsAFunctionInTheClass( void* Object );
}

Essentially what you are doing is creating a wrapper which binds to the library and rexports all the methos through a C style (non-mangled) means. CreateObject create a new insatiation of the class and returns a pointer to the object, Destroy object delets it when you are done with it, and then you would write a function which takes the object and calls the corresponding function on the object and returns the value.

You can create a library with this new project you created which should be importable to DevC++, or even a DLL (though i do not recommend that since DLL-Proxies are memory inefficient).

Try googling "exporting C++ interfaces through C" or "flattening C++ dlls" if you find a few examples on the net, you are bound to understand the technique a bit better.
__________________
Clifford Matthew Roche <geek@cliffordroche.com>
Web Hosting: http://www.crd-hosting.com
Consulting: http://www.crdev-consulting.com
kurifu is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:59 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC