Cancelado

Translate short Delphi DLL (129 lines) to Visual Studio C++(repost)

Translate a short (129 lines) Delphi DLL to a Visual Studio C++ Project. You find the Delphi DLL Source in the description.

## Deliverables

I tried to translate it on my own. Here is my C++ trial that does not work. Maybe you can use it as a starting point:

#ifndef _DLL_H_

#define _DLL_H_

#if BUILDING_DLL

# define DLLIMPORT __declspec (dllexport)

#else /* Not BUILDING_DLL */

# define DLLIMPORT __declspec (dllimport)

#endif /* Not BUILDING_DLL */

#include <[url removed, login to view]>

class DLLIMPORT DllClass

{

public:

DllClass();

virtual ~DllClass(void);

private:

};

class TMyClass;

struct TRegisterProcRec;

{

typedef int __fastcall (*TRegisterNamespace )( int , const String );

typedef int __fastcall (*TRegisterConstant )( int , const String , const Variant );

typedef int __fastcall (*TRegisterVariable )( int , const String , int , void* );

typedef int __fastcall (*TRegisterHeader )( int , const String , void* , int = 0, int = 0 );

typedef int __fastcall (*TRegisterProperty )( int , const String );

typedef int __fastcall (*TRegisterClassType )( int , TMetaClass* , bool = false );

typedef int __fastcall (*TRegisterClassReferenceType )( int , const String , const String );

typedef int __fastcall (*TRegisterClassTypeField )( int , const String );

typedef int __fastcall (*TRegisterRecordType )( int , const String , bool = false );

typedef int __fastcall (*TRegisterRecordTypeField )( int , const String );

typedef int __fastcall (*TRegisterVariantRecordTypeField )( int , const String , __int64 );

typedef int __fastcall (*TRegisterEnumType )( int , const String , int = 7 );

typedef int __fastcall (*TRegisterEnumValue )( int , const String , const int );

typedef int __fastcall (*TRegisterSubrangeType )( int , const String , int , int , int );

typedef int __fastcall (*TRegisterArrayType )( int , const String , int , int , bool = false );

typedef int __fastcall (*TRegisterDynamicArrayType )( int , const String , int );

typedef int __fastcall (*TRegisterPointerType )( int , const String , int );

typedef int __fastcall (*TRegisterSetType )( int , const String , int );

typedef int __fastcall (*TRegisterProceduralType )( int , const String , int );

typedef int __fastcall (*TRegisterEventType )( int , const String , int );

typedef int __fastcall (*TRegisterShortStringType )( int , const String , int );

typedef int __fastcall (*TRegisterInterfaceType )( int , const String , const TGUID , const String , const TGUID );

// TRegisterRTTIType = function(LevelId: Integer; pti: PTypeInfo): Integer;

typedef int __fastcall (*TRegisterTypeAlias )( int , const String , int );

struct TRegisterProcRec {

TRegisterNamespace RegisterNamespace;

TRegisterConstant RegisterConstant;

TRegisterVariable RegisterVariable;

TRegisterHeader RegisterHeader;

TRegisterProperty RegisterProperty;

TRegisterClassType RegisterClassType;

TRegisterClassTypeField RegisterClassTypeField;

TRegisterClassReferenceType RegisterClassReferenceType;

TRegisterRecordType RegisterRecordType;

TRegisterRecordTypeField RegisterRecordTypeField;

TRegisterVariantRecordTypeField RegisterVariantRecordTypeField;

TRegisterEnumType RegisterEnumType;

TRegisterEnumValue RegisterEnumValue;

TRegisterSubrangeType RegisterSubrangeType;

TRegisterArrayType RegisterArrayType;

TRegisterDynamicArrayType RegisterDynamicArrayType;

TRegisterPointerType RegisterPointerType;

TRegisterSetType RegisterSetType;

TRegisterProceduralType RegisterProceduralType;

TRegisterEventType RegisterEventType;

TRegisterShortStringType RegisterShortStringType;

TRegisterInterfaceType RegisterInterfaceType;

TRegisterTypeAlias RegisterTypeAlias;

};

typedef void __fastcall (*TRegisterDllProc )( const TRegisterProcRec& );

class TMyClass: public System::TObject {

public:

void __fastcall P( );

public: inline __fastcall TMyClass () {}

};

const int MyConst = 123;

int __fastcall MyFunc( int x, int y, int& MyConst )

{

int result = 0;

result = x + y;

return result;

}

void __fastcall TMyClass::TMyClass::P( )

{

writeln( 'P' );

}

void __fastcall RegisterDllProcs( const TRegisterProcRec& PaxRegisterProcs, int& MyConst )

{

int G = 0, H = 0;

{

H = [url removed, login to view]( 0, "u2" );

[url removed, login to view]( H, "MyConst", 123 );

G = [url removed, login to view]( H, __classid( TMyClass ) );

[url removed, login to view]( G, "procedure P;", &TMyClass::P());

[url removed, login to view]( G, "constructor Create;", __classid( new TMyClass ) );

[url removed, login to view]( H, "function MyFunc(X, Y: Integer): Integer;", &MyFunc( , MyConst) );

}

}

exports RegisterDllProcs;

}

#endif /* _DLL_H_ */

Habilidades: Programação C, Microsoft, Arquitetura de software, Área de trabalho do Windows

Ver mais: registerarraytype, work translate, visual studio programming, virtual int, struct programming, programming visual studio, programming delphi, find work translate, else programming, dll system programming, define virtual function, define programming, virtual constructor, string programming, programming typedef, programming string, programming else, programming function, programming find function, programming define, my c, integer programming, dll, delphi programming, c p

Acerca do Empregador:
( 2 comentários ) Germany

ID do Projeto: #2994140

1 freelancer está ofertando em média $85 para este trabalho

stasenberginc

See private message.

$85 USD in 14 dias
(65 Comentários)
6.6