I got a VST plug-in working under Lazarus!

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

Hi,

I successfully compiled one of my plug-ins using Lazarus. It compiles without problem, however, the .dll is not recognized by any VST host 'dispatcher not found'.

All units compile fine, perhaps there is a specific configuration of the Compiler/Linker I am missing.

Did anyone else here have any experience compiling a VST plug-in under Lazarus - and get it to work?

I am experimenting with Lazarus as a potential route to making some of my plug-ins available on Mac. :wink:

Cheers
Last edited by Space Boy on Sun Mar 26, 2006 9:45 am, edited 2 times in total.
Image

Post

porting to mac ?!?
sounds interesting ...

what is lazarus ? do you got an url ?

Post

Image


Post

I'm about to embark on such a venture as well.. do you have any tips on setting it up? I'm so used to delphi after 8 years, I'm still trying to get my head around the 'same but different' thing.

any help gladly appreciated.

wrt to the dll - ensure that exports are right. whatever else you export, make sure that you have:

Code: Select all

function main(audioMaster: TAudioMasterCallbackFunc): PAEffect; cdecl;
the cdecl is very important, and I assume that FP supports it. ask in the user forum.

try writing a simple program that uses loadlibrary and gets the function address of main. No VST stuff, just make sure that the library loads as it should. Then try something like minihost core, where you can see what is failing from the VST side..

just some suggestions :)

DSP
Image

Post

duncanparsons wrote:wrt to the dll - ensure that exports are right. whatever else you export, make sure that you have:

Code: Select all

function main(audioMaster: TAudioMasterCallbackFunc): PAEffect; cdecl;
the cdecl is very important, and I assume that FP supports it. ask in the user forum.
DSP
The cdecl is included, the dll compiles fine, no complaints. VST host reports that it is not a valid plug-in.

I have some questions also posted in the Lazarus forum
Image

Post

Just found this

http://lists.freepascal.org/lists/fpc-p ... 07886.html

Seems I was not alone with the problem.
Image

Post

grim...

can you write a std LoadLibrary call (I'm at home at the moment, I have Laz on a PC @ work..), and look up the function?

If you define a Tmain func with cdecl, etc, then try to access the dll fn, does it work?

My question is - Is it something about the way VST is working, or is it genuinely the linker?

also, which FPC are you using? is it the latest?

DSP
Image

Post

Just found your post on the forae :)

by doing a search on cdecl, it looks like FPC has a problem with the directive. Compilation wouldn't really be a problem, it's more how it puts the parameters on the stack.. however, with only one param in VSTland, you wonder what could go wrong... for a laugh, try it with 'pascal' or 'stdcall' (even 'fastcall') conventions, and see what difference it makes..

DSP
Image

Post

Hi,

I think the problem may be more to do with how Lazarus generates a .dll than the VST related details.

I made a small test procedure. It consists of an application written in Lazarus called "test_dll.exe". This application opens a window with two buttons. One button executes a procedure contained in a .dll written using Lazarus, and the other button executes a similar procedure contained in a .dll written in Delphi.

The code for both .dlls is essentially identical between Lazarus and Delphi. However, the Delphi .dll is successfully executed by the "test_dll.exe" and the Lazarus .dll causes an error.

I make the source code available for test routine and .dlls at this link.

Download DLL_Test.zip

Unizip to a temporary directory:

Under Lazarus open the "test_dll.lpi" project and compile.
Under Lazarus open the "mydll.lpi" project and compile.
Under Delphi open the "mydllD.dpr" project and compile.

Double click the "test_dll.exe" and try clicking the buttons.

The Lazarus compiled .dll does not work.

Complied using Lazarus 0.9.12 Beta.
Image

Post

I've backed up your post on the lazarus forum. I have come to the same conclusion as you. It was the search on cdecl tha did it for me.

However, trying your test was interesting.. the wikis swear blind that you can compile dlls OK. I tried using the {$MODE Delphi} just in case, but to no avail.

It would be worth putting that link on the forum (if you haven't already). From what I can see from the docs, stdcall should work alright.

ho hum..

DSP
Image

Post

Just seen that you have put this up, and I've posted my comments.. hopefully this will generate a fix :)

DSP
Image

Post

Yep,

I tried all manner of combinations - no luck.

I at least expect Lazarus to be able to generate and load its own .dlls. When it can do that then I think we're more than half way there.

Cheers

Paul
Image

Post

I just want to thank everyone experimenting with Lazarus. I'm one of those Delphi developers who has an eye on it. A Lazarus 1.0 is going to be great for the Delphi/Pascal community.
TIME IS WHAT KEEPS EVERYTHING FROM HAPPENING ALL AT ONCE.

Post

Space Boy, you must replace "program" with "library" in test_dll.lpr

Dll is called dynlib on mac, but I dont think you can do it with FPC yet. It compiles, but the .dynlib doesnt work/load. (unless they have fixed it recently)

cheers
jorgen
Half developer half human
XT Software
http://www.energy-xt.com

Post Reply

Return to “DSP and Plugin Development”