Teen Programmers Unite  
 

 

Return to forum top

Using DLLs in BC5

Posted by Cortez [send private reply] at September 01, 2002, 02:14:35 AM

Well, I have a zip dll and I know which function to call with which arguements but I don't know how to use DLL in C! The function is zipmain. How can I use it Borland C 5.5?

And what happens if a function already exits in dll with the same name of one of the C code?

Posted by CViper [send private reply] at September 01, 2002, 04:01:44 AM

there are two ways of "using" a DLL: either you link staticly to it through some library file, or you load it during runtime with LoadLibrary().
To retrive an pointer to the function just call GetProcAddress()

Check the MSDN for more info.

Posted by Cortez [send private reply] at September 01, 2002, 07:50:28 AM

OK, I found something. By the way, how can I play midi in BC? Can you write a very little sample program? I don't even know which file I should include (please don't refer MSDN!)

Posted by Psion [send private reply] at September 01, 2002, 08:36:11 AM

Asking someone not to refer to readily available documentation is not the best of practices.

Posted by CViper [send private reply] at September 01, 2002, 10:52:41 AM

char buff[128];

mciSendString( "open <midi file path> type sequencer alias <id>", buff, 127, NULL );
mciSendString( "play <id> wait", buff, 127, NULL );
mciSendString( "close <id>", buff, 127, NULL );


Since you said not to refere to the MSDN, i can't tell you to look up all the other functions available using mciSendString (like playing CD's & Videos or "advanced" sequencer stuff)...

NOTE: for the above code to work, you have to include "winmm.lib" for linking
You must be logged in to post messages and see which you have already read.

Log on
Username:
Password:
Save for later automatic logon

Register as a new user
 
Copyright TPU 2002. See the Credits and About TPU for more information.