Page 1 of 4 123 ... LastLast
Results 1 to 10 of 32

Thread: Delphi libs can be used in C++ ?

  1. #1

    Delphi libs can be used in C++ ?

    The lib Have some classes, but the rest is very simple :?

    it can be done?
    From brazil (:

    Pascal pownz!

  2. #2

    Delphi libs can be used in C++ ?

    i need some help here :?

    I think classes in C++ are not compatible with Pascal classes,
    what i will need to do?
    From brazil (:

    Pascal pownz!

  3. #3

    Delphi libs can be used in C++ ?

    use plain objects or records.
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

  4. #4

    Delphi libs can be used in C++ ?

    You can always make a DLL and make it C++ compatible

    You cannot use dynamic array's and most string types (Use PChar instead). You cannot use pascal classes either. If you want your library to be a little more Object oriented you can also use Interfaces (derived from IUnknown). That way you can make C++ compatilbe API's with pascal

    P.S: all exported DLL routines need STDCALL calling conventions
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  5. #5

    Delphi libs can be used in C++ ?

    Quote Originally Posted by Delfi
    use plain objects or records.
    Appers to be same as C++ libs -> delphi,

    i was writing irrlang headers to pascal using ""Flattening" the object" model, but i stoped, there are many better libs around already converted to pascal,

    i have some doubts,

    how can i generate a .lib of a delphi dll ?

    i will use type def to define a own type of void type, and pass it on a argument to the exported plain functions of the class?

    Thill will work?

    Code:
    typedef void Psomeclass; 
    // i will need more coding to import the functions here, but this is just an example
    Psomeclass Psomeclass_create(void)
    void Psomeclass_dosomething(void handle)
    Code:
    type
    Psomeclass = ^TsomeClass;
    TsomeClass = class
    public
    procedure dosomething;
    constructor create;
    end;
    
    constructor Tsomeclass.create;
    begin
    // CONSTRUCTOR
    end;
    
    procedure Tsomeclass.dosomething;
    begin
    // DO SOMETHING
    end;
    Code:
    function Psomeclass_create: Psomeclass; stdcall;
    begin
    result := @TSomeclass.create;
    end;
    
    procedure Psomeclass_dosomething(handle : Psomeclass); stdcall;
    begin
    handle.dosomething;
    end;
    
    exports
     Psomeclass_dosomething, Psomeclass_create;
    ~chronozphere:
    Yeah im very interested in OO, but i don't know what is interfaces ;p
    can you give me more details?


    sorry my english :?
    From brazil (:

    Pascal pownz!

  6. #6

    Delphi libs can be used in C++ ?

    I'm afraid that if you want to create an object oriented library in Delphi to use from C++ you will need to create something similar to COM objects. :shock: Like DirectX and so on.
    So start to learn interfaces. They are necessary to create COM objects. :roll:

  7. #7

    Delphi libs can be used in C++ ?

    I read some things about interface, its like an skeleton for classes, them i create a real class from it that implements all its functionalities;

    all right in pascal but how i will import that on C++ ?
    From brazil (:

    Pascal pownz!

  8. #8

    Delphi libs can be used in C++ ?

    First you have to learn C. :roll: :razz:

    You must translate the interface, type and constant definitions to a C and assemble them in a C header. This will be the import header for your library, and it should contain all datatypes, constants, interfaces etc etc, that are needed to work with your library.

    Then the user can e.g Call The "MyEngine_Init" routine that is defined in that header to initialize the library and start working with it

    First step is to learn how to create DLL's with exported functions, after that, learn how to use interfaces for Application <-> DLL communication. And finally, learn some C++ so you can make a C header for your lib.

    Good luck
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  9. #9

    Delphi libs can be used in C++ ?

    Quote Originally Posted by chronozphere
    First you have to learn C. :roll: :razz:

    You must translate the interface, type and constant definitions to a C and assemble them in a C header. This will be the import header for your library, and it should contain all datatypes, constants, interfaces etc etc, that are needed to work with your library.

    Then the user can e.g Call The "MyEngine_Init" routine that is defined in that header to initialize the library and start working with it

    First step is to learn how to create DLL's with exported functions, after that, learn how to use interfaces for Application <-> DLL communication. And finally, learn some C++ so you can make a C header for your lib.

    Good luck
    so use dynamic loading insted of static, good, i will don't need .lib's

    I know a descent level of C++ programming, nothing that some google don't solve

    I already have writed all structs, types and consts to the .h
    but the main code still blank =/

    after some research
    i noticed that best way, is to work with full abstract classes, i will make some tests

    PS: im getting confused, you are giving me some good tips but i still have unanswered questions
    From brazil (:

    Pascal pownz!

  10. #10

    Delphi libs can be used in C++ ?

    PS: im getting confused, you are giving me some good tips but i still have unanswered questions
    Okay... I guess you need to tell me agian, what you want to know

    how can i generate a .lib of a delphi dll ?
    I don't really know what i lib is (i think it has to do with Linux), but i don't think you can do that.
    Just using the DLL will be sufficient (unless you want your application to work on Linux or Mac).

    i will use type def to define a own type of void type, and pass it on a argument to the exported plain functions of the class?
    Sorry, i don't completely understand the question :? Maybe you can rephrase it?
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

Page 1 of 4 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •