drezgames
03-03-2022, 05:01 AM
https://raw.githubusercontent.com/tinyBigGAMES/CPas/main/media/logo.png (https://github.com/tinyBigGAMES/CPas)
https://img.shields.io/discord/754884471324672040.svg?logo=discord (https://discord.gg/tPWjMwK) https://img.shields.io/github/stars/tinyBigGAMES/CPas?style=social (https://github.com/tinyBigGAMES/CPas/stargazers) https://img.shields.io/github/watchers/tinyBigGAMES/CPas?style=social (https://github.com/tinyBigGAMES/CPas/network/members) https://img.shields.io/github/forks/tinyBigGAMES/CPas?style=social (https://github.com/tinyBigGAMES/CPas/network/members) https://img.shields.io/twitter/follow/tinyBigGAMES?style=social (https://twitter.com/tinyBigGAMES)
Overview
What if you were able to load and use C99 sources directly from Delphi? There is a vast quantity of C libraries out there and being able to take advantage of them, without being a pain would be nice. You could even compile a bunch of sources and save them as a library file, then load them back in from disk, a resource or even from a stream. You can get the symbols, map to a C routine, and execute from the Delphi side all from a simple API.
Downloads
Releases (https://github.com/tinyBigGAMES/CPas/releases) - These are the official release versions.
Features
Free for commercial use. See License agreement (https://github.com/tinyBigGAMES/CPas/blob/main/LICENSE).
Allow C integration with Delphi (https://www.embarcadero.com/products/Delphi) at run-time.
Support Windows 64-bit platform.
Support for C99.
Fast run-time compilation.
Can run C sources directly or compile them to a library file (.LIB).
Library files can be loaded and used at run-time from a file, a resource or stream.
Import symbols directly from a dynamic linked library (.DLL) or module-definition (.DEF) file.
You can reference the symbols from Delphi and directly access their value (mapping to a routine and data).
Your application can dynamically or statically link to CPas.
Direct access to the vast quantity of C99 libraries inside Delphi.
Minimum System Requirements
Delphi 10
Microsoft Windows 10, 64 bits
10MB of free hard drive space
How to use in Delphi
Unzip the archive to a desired location.
Add installdir\sources, folder to Delphi's library path so the CPas source files can be found for any project or for a specific project add to its search path.
Add installdir\bin, folder to Windows path so that CPas.dll file can be found for any project or place beside project executable.
See examples in installdir\examples for more information about usage.
You must include CPas.dll in your project distribution when dynamically linked to CPas. See CPAS_STATIC define in the CPas unit file.
See installdir\docs for documentation.
NOTE: For your assurance and peace of mind, all official executables in the CPas distro that were created by us are code signed by tinyBigGAMES LLC.
A Tour of CPas
CPas API
You access the easy-to-use API in Delphi from the CPas unit.
{.$DEFINE CPAS_STATIC} //<-- define for static distribution
type
{ TCPas }
TCPas = type Pointer;
{ TCPasOutput }
TCPasOutput = (cpMemory, cpLib);
{ TCPasErrorMessageEvent }
TCPasErrorEvent = procedure(aSender: Pointer; const aMsg: WideString);
{ Misc }
function cpVersion: WideString;
{ State management }
function cpNew: TCPas;
procedure cpFree(var aCPas: TCPas);
procedure cpReset(aCPas: TCPas);
{ Error handling }
procedure cpSetErrorHandler(aCPas: TCPas; aSender: Pointer; aHandler: TCPasErrorEvent);
procedure cpGetErrorHandler(aCPas: TCPas; var aSender: Pointer; var aHandler: TCPasErrorEvent);
{ Preprocessing }
procedure cpDefineSymbol(aCPas: TCPas; const aName: WideString; const aValue: WideString);
procedure cpUndefineSymbol(aCPas: TCPas; const aName: WideString);
function cpAddIncludePath(aCPas: TCPas; const aPath: WideString): Boolean;
function cpAddLibraryPath(aCPas: TCPas; const aPath: WideString): Boolean;
{ Compiling }
procedure cpSetOuput(aCPas: TCPas; aOutput: TCPasOutput);
function cpAddFile(aCPas: TCPas; const aFilename: WideString): Boolean;
function cpCompileString(aCPas: TCPas; const aBuffer: string): Boolean;
procedure cpAddSymbol(aCPas: TCPas; const aName: WideString; aValue: Pointer);
function cpLoadLibFromFile(aCPas: TCPas; const aFilename: WideString): Boolean;
function cpLoadLibFromResource(aCPas: TCPas; const aResName: WideString): Boolean;
function cpLoadLibFromStream(aCPas: TCPas; aStream: TStream): Boolean;
function cpSaveLibToFile(aCPas: TCPas; const aFilename: WideString): Boolean;
function cpLink(aCPas: TCPas): Boolean;
function cpRun(aCPas: TCPas): Boolean;
function cpGetSymbol(aCPas: TCPas; const aName: WideString): Pointer;
{ Stats }
procedure cpStartStats(aCPas: TCPas);
function cpEndStats(aCPas: TCPas; aShow: Boolean): WideString;
If you want CPas to be statically bound to your application, enable the {$CPAS_STATIC} define in the CPas unit.
How to use
A minimal implementation example:
uses
System.SysUtils,
CPas;
var
c: TCPas;
// CPas error handler
procedure ErrorHandler(aSender: Pointer; const aMsg: WideString);
begin
WriteLn(aMsg);
end;
begin
// create a CPas instance
c := cpNew;
try
// setup the error handler
cpSetErrorHandler(c, nil, ErrorHandler);
// add source file
cpAddFile(cp, 'test1.c');
// link and call main
cpRun(cp);
finally
// destroy CPas instance
cpFree(c);
end;
end.
See the examples for more information on usage.
Media
https://www.youtube.com/watch?v=-9eEKHtJlhk
Support
Project Discussions
https://github.com/tinyBigGAMES/CPas/discussions
Project Tracking
https://github.com/tinyBigGAMES/CPas/projects
Website
https://tinybiggames.com (https://tinybiggames.com/)
E-Mail
support@tinybiggames.com
Discord
https://discord.io/tinyBigGAMES (https://discord.gg/tPWjMwK)
Twitter
https://twitter.com/tinyBigGAMES
Facebook
https://facebook.com/tinyBigGAMES
YouTube
https://youtube.com/tinyBigGAMES
Sponsor
If this project has been useful to you, please consider sponsoring to help with its continued development. Thank You! :welcoming:
https://img.buymeacoffee.com/button-api/?text=Sponsor%20this%20project&emoji=&slug=tinybiggames&button_colour=FFDD00&font_colour=000000&font_family=Cookie&outline_colour=000000&coffee_colour=ffffff (https://www.buymeacoffee.com/tinybiggames)
https://raw.githubusercontent.com/tinyBigGAMES/CPas/main/media/delphi.png (https://www.embarcadero.com/products/delphi)
❤ Made in Delphi
https://img.shields.io/discord/754884471324672040.svg?logo=discord (https://discord.gg/tPWjMwK) https://img.shields.io/github/stars/tinyBigGAMES/CPas?style=social (https://github.com/tinyBigGAMES/CPas/stargazers) https://img.shields.io/github/watchers/tinyBigGAMES/CPas?style=social (https://github.com/tinyBigGAMES/CPas/network/members) https://img.shields.io/github/forks/tinyBigGAMES/CPas?style=social (https://github.com/tinyBigGAMES/CPas/network/members) https://img.shields.io/twitter/follow/tinyBigGAMES?style=social (https://twitter.com/tinyBigGAMES)
Overview
What if you were able to load and use C99 sources directly from Delphi? There is a vast quantity of C libraries out there and being able to take advantage of them, without being a pain would be nice. You could even compile a bunch of sources and save them as a library file, then load them back in from disk, a resource or even from a stream. You can get the symbols, map to a C routine, and execute from the Delphi side all from a simple API.
Downloads
Releases (https://github.com/tinyBigGAMES/CPas/releases) - These are the official release versions.
Features
Free for commercial use. See License agreement (https://github.com/tinyBigGAMES/CPas/blob/main/LICENSE).
Allow C integration with Delphi (https://www.embarcadero.com/products/Delphi) at run-time.
Support Windows 64-bit platform.
Support for C99.
Fast run-time compilation.
Can run C sources directly or compile them to a library file (.LIB).
Library files can be loaded and used at run-time from a file, a resource or stream.
Import symbols directly from a dynamic linked library (.DLL) or module-definition (.DEF) file.
You can reference the symbols from Delphi and directly access their value (mapping to a routine and data).
Your application can dynamically or statically link to CPas.
Direct access to the vast quantity of C99 libraries inside Delphi.
Minimum System Requirements
Delphi 10
Microsoft Windows 10, 64 bits
10MB of free hard drive space
How to use in Delphi
Unzip the archive to a desired location.
Add installdir\sources, folder to Delphi's library path so the CPas source files can be found for any project or for a specific project add to its search path.
Add installdir\bin, folder to Windows path so that CPas.dll file can be found for any project or place beside project executable.
See examples in installdir\examples for more information about usage.
You must include CPas.dll in your project distribution when dynamically linked to CPas. See CPAS_STATIC define in the CPas unit file.
See installdir\docs for documentation.
NOTE: For your assurance and peace of mind, all official executables in the CPas distro that were created by us are code signed by tinyBigGAMES LLC.
A Tour of CPas
CPas API
You access the easy-to-use API in Delphi from the CPas unit.
{.$DEFINE CPAS_STATIC} //<-- define for static distribution
type
{ TCPas }
TCPas = type Pointer;
{ TCPasOutput }
TCPasOutput = (cpMemory, cpLib);
{ TCPasErrorMessageEvent }
TCPasErrorEvent = procedure(aSender: Pointer; const aMsg: WideString);
{ Misc }
function cpVersion: WideString;
{ State management }
function cpNew: TCPas;
procedure cpFree(var aCPas: TCPas);
procedure cpReset(aCPas: TCPas);
{ Error handling }
procedure cpSetErrorHandler(aCPas: TCPas; aSender: Pointer; aHandler: TCPasErrorEvent);
procedure cpGetErrorHandler(aCPas: TCPas; var aSender: Pointer; var aHandler: TCPasErrorEvent);
{ Preprocessing }
procedure cpDefineSymbol(aCPas: TCPas; const aName: WideString; const aValue: WideString);
procedure cpUndefineSymbol(aCPas: TCPas; const aName: WideString);
function cpAddIncludePath(aCPas: TCPas; const aPath: WideString): Boolean;
function cpAddLibraryPath(aCPas: TCPas; const aPath: WideString): Boolean;
{ Compiling }
procedure cpSetOuput(aCPas: TCPas; aOutput: TCPasOutput);
function cpAddFile(aCPas: TCPas; const aFilename: WideString): Boolean;
function cpCompileString(aCPas: TCPas; const aBuffer: string): Boolean;
procedure cpAddSymbol(aCPas: TCPas; const aName: WideString; aValue: Pointer);
function cpLoadLibFromFile(aCPas: TCPas; const aFilename: WideString): Boolean;
function cpLoadLibFromResource(aCPas: TCPas; const aResName: WideString): Boolean;
function cpLoadLibFromStream(aCPas: TCPas; aStream: TStream): Boolean;
function cpSaveLibToFile(aCPas: TCPas; const aFilename: WideString): Boolean;
function cpLink(aCPas: TCPas): Boolean;
function cpRun(aCPas: TCPas): Boolean;
function cpGetSymbol(aCPas: TCPas; const aName: WideString): Pointer;
{ Stats }
procedure cpStartStats(aCPas: TCPas);
function cpEndStats(aCPas: TCPas; aShow: Boolean): WideString;
If you want CPas to be statically bound to your application, enable the {$CPAS_STATIC} define in the CPas unit.
How to use
A minimal implementation example:
uses
System.SysUtils,
CPas;
var
c: TCPas;
// CPas error handler
procedure ErrorHandler(aSender: Pointer; const aMsg: WideString);
begin
WriteLn(aMsg);
end;
begin
// create a CPas instance
c := cpNew;
try
// setup the error handler
cpSetErrorHandler(c, nil, ErrorHandler);
// add source file
cpAddFile(cp, 'test1.c');
// link and call main
cpRun(cp);
finally
// destroy CPas instance
cpFree(c);
end;
end.
See the examples for more information on usage.
Media
https://www.youtube.com/watch?v=-9eEKHtJlhk
Support
Project Discussions
https://github.com/tinyBigGAMES/CPas/discussions
Project Tracking
https://github.com/tinyBigGAMES/CPas/projects
Website
https://tinybiggames.com (https://tinybiggames.com/)
support@tinybiggames.com
Discord
https://discord.io/tinyBigGAMES (https://discord.gg/tPWjMwK)
https://twitter.com/tinyBigGAMES
https://facebook.com/tinyBigGAMES
YouTube
https://youtube.com/tinyBigGAMES
Sponsor
If this project has been useful to you, please consider sponsoring to help with its continued development. Thank You! :welcoming:
https://img.buymeacoffee.com/button-api/?text=Sponsor%20this%20project&emoji=&slug=tinybiggames&button_colour=FFDD00&font_colour=000000&font_family=Cookie&outline_colour=000000&coffee_colour=ffffff (https://www.buymeacoffee.com/tinybiggames)
https://raw.githubusercontent.com/tinyBigGAMES/CPas/main/media/delphi.png (https://www.embarcadero.com/products/delphi)
❤ Made in Delphi