0

I'm using Embarcadero XE8 C++ builder 32 bit and I'm trying to convert a .dll file to a .lib. I did this with using the implib-tool. more info here.

I've got my new .lib file now. And it isn't working so I used a TDumpon the library. When I check out the Tdump, the names aren't correct.

Instead of having the name: CEasyPLCHandler it says ??0CEasyPLCHandler@@QAE@ABV0@@Z.

It seems that every method in the library added the ??0 at the start and @@QAE@ABV0@@Zat the end. When I simply open the library and replace ??0and @@QAE@ABV0@@Z with nothing it gives a new error:

.lib contains invalid OMF record, type 0x50

So I can't just simply change the text in the library.

How can I change the method names in my library? If that isn't possible how can I get my library working? I already made a topic about converting files: Linker error “contains invalid OMF record” 2

Community
  • 1
  • 1
Bart
  • 717
  • 1
  • 9
  • 28
  • 5
    You might want to read about [*name mangling*](https://en.wikipedia.org/wiki/Name_mangling). – Some programmer dude Sep 22 '15 at 06:56
  • Also note that `implib` will not convert a .dll to a .lib. It will just make an import library so you can use the dll in your project. – wimh Sep 22 '15 at 07:05
  • @Wimmel So I also should include the .dll file or? how does that work? – Bart Sep 22 '15 at 07:09
  • You will need the .dll at runtime. But as you seem to have problems compiling, you have to fix that first. – wimh Sep 22 '15 at 07:12
  • @Wimmel well I get the errors of Unresolved external errors, so I need to get my library fixed first. – Bart Sep 22 '15 at 07:15
  • @JoachimPileborg When I check the DLL file it actually shows the same stuff as the .lib file. the `??0` and `@@QAE@ABV0@@Z` or some other code on the end is added to the methods. – Bart Sep 22 '15 at 08:44
  • You *did* read the article I linked to in my previous comment? – Some programmer dude Sep 22 '15 at 08:53
  • Yes I read it, it's about adding symbols to indentify what it is. And since my lib has more CEasyPLCHandler constructors it adds these symbols. But ye, the problem is just a visual basic .lib doesnt use the same symbols as a C++ builder .lib – Bart Sep 22 '15 at 08:59
  • So you want to use these symbols from an external application, like a Visual Basic program? Then you need to explore the `extern "C"` linkage specifier with causes symbols not to be mangled, or some other way to load and use the DLL with the mangled names. – Some programmer dude Sep 22 '15 at 09:08
  • Well simply, I'm trying to convert a visual basic .lib to a C++ builder lib. Some methods are correctly given but some aren't because of this problem. how does `the extern "C"` part works? I'm pretty new to C++ and Embarcadero. – Bart Sep 22 '15 at 09:22
  • _I'm trying to convert a visual basic .lib to a C++ builder lib._ - I think you need to ask visual basic experts what you need to do in visual basic to allow to use the .dll in c++. The answer might be that it is not possible, but I don't know. It might also depend on the visual basic version you are using. The main problem is that you need a header file to use the .lib you created. A better approach might be creating a COM object in visual basic, and use that in c++ builder. That will work, but you need knowledge of COM, both in visual basic as in c++. – wimh Sep 22 '15 at 15:14

0 Answers0