Board index » cppbuilder » Where do I start to build a dll

Where do I start to build a dll


2007-10-02 01:07:18 PM
cppbuilder110
I use a tool called abcm2ps to convert ascii text abc music files to postscript music score.
The tool is usually invoked from a command line, and fed with parameters to indicate the abc file to open, and the tune number within the file, and an assortment of other options.
Several GUIs exist which invoke abcm2ps as an external program, and import the resultant postscript file for viewing/printing.
Can anyone suggest where/how I should begin to turn the external executable into a dll to do realtime conversion on the fly so that as edits are done to the plain text file, the resulting music score is shown.
The sourcecode in c is freely available for abcm2ps, and I can compile the source into exe.
Any suggestions are welcome.
Thanks,
Barry.
 
 

Re:Where do I start to build a dll

Barry schreef:
Quote
I use a tool called abcm2ps to convert ascii text abc music files to postscript music score.
The tool is usually invoked from a command line, and fed with parameters to indicate the abc file to open, and the tune number within the file, and an assortment of other options.
Several GUIs exist which invoke abcm2ps as an external program, and import the resultant postscript file for viewing/printing.
Can anyone suggest where/how I should begin to turn the external executable into a dll to do realtime conversion on the fly so that as edits are done to the plain text file, the resulting music score is shown.
The sourcecode in c is freely available for abcm2ps, and I can compile the source into exe.
Any suggestions are welcome.
Thanks,
Barry.
Basically, you have to drop the main function and create new functions
that provide an interface your app can call.
Maybe you could ask some more detailed questions?
Notice that the sourcecode is licensed under the GPL. So any app which
uses the DLL has to be GPL to.
Eelke
 

Re:Where do I start to build a dll

Barry wrote:
Quote
Can anyone suggest where/how I should begin to turn the external executable into a dll to do realtime conversion on the fly so that as edits are done to the plain text file, the resulting music score is shown.
Start with how you want to use it.
I assume you would want at least two functions:
void SetOptions( char* Options );
You could pass the commandline parameters, not including file name,
and use the existing code to set the options.
int Translate( char*ABCData, int LenABCData, char*PSData, int sizePSData );
You pass in a buffer of ABC data, and the size of it, and also pass in an empty buffer to
receive the PS data, and the size of that buffer. The DLL does its thing, returning the
required PSData size, while filling (and not overflowing) the PSData buffer.
If returned value>sizePSData then App needs to use larger PSData buffer (or less input
data).
You could also add
int GetRequiredSize( char*ABCData, int LenABCData);
to make it easier to set your PSData buffer size.
SetOptions( "-M -Z" );
int sizePSData = GetRequiredSize( "ABCDEFG", 7 );
char *PSData = malloc( sizePSDATA );
Translate( "ABCEDFG, 7, PSData, sizePSData );
{ .. display PSData .. }
free( PSData );
 

{smallsort}

Re:Where do I start to build a dll

Bob Gonder < XXXX@XXXXX.COM >wrote:
Quote
Barry wrote:

>Can anyone suggest where/how I should begin to turn the external executable into a dll to do realtime conversion on the fly so that as edits are done to the plain text file, the resulting music score is shown.

Start with how you want to use it.
I assume you would want at least two functions:

void SetOptions( char* Options );
You could pass the commandline parameters, not including file name,
and use the existing code to set the options.

int Translate( char*ABCData, int LenABCData, char*PSData, int sizePSData );
You pass in a buffer of ABC data, and the size of it, and also pass in an empty buffer to
receive the PS data, and the size of that buffer. The DLL does its thing, returning the
required PSData size, while filling (and not overflowing) the PSData buffer.
If returned value>sizePSData then App needs to use larger PSData buffer (or less input
data).
You could also add
int GetRequiredSize( char*ABCData, int LenABCData);
to make it easier to set your PSData buffer size.

SetOptions( "-M -Z" );
int sizePSData = GetRequiredSize( "ABCDEFG", 7 );
char *PSData = malloc( sizePSDATA );
Translate( "ABCEDFG, 7, PSData, sizePSData );
{ .. display PSData .. }
free( PSData );

Thanks for the suggestions. That gives me a starting point, so I'm off and running. Should keep me busy for a while.
Barry.
 

Re:Where do I start to build a dll

Bob Gonder < XXXX@XXXXX.COM >wrote:
Quote
SetOptions( "-M -Z" );
int sizePSData = GetRequiredSize( "ABCDEFG", 7 );
char *PSData = malloc( sizePSDATA );
Translate( "ABCEDFG, 7, PSData, sizePSData );
{ .. display PSData .. }
free( PSData );
Or, for a more C++ solution:
SetOptions( "-M -Z" );
std::vector<char>PSData(GetRequiredSize( "ABCDEFG", 7 ));
Translate( "ABCEDFG, 7, &PSData[0], PSData.size());
{ .. display PSData .. }
Alan Bellingham
--
Team Browns
<url:www.borland.com/newsgroups/>Borland newsgroup descriptions
<url:www.borland.com/newsgroups/netiquette.html>netiquette