[fpc-pascal] Compiling library / Win32 DLL

chromdildo chromdildo at t-online.de
Thu Dec 29 19:25:32 CET 2005


Thanks for your reply.

Whats the difference, when compiling without Lazarus?
The library relys on the LCL (for GUI) and compiling from commandline
results in exactly the same (non working) dll.
Where can I learn more about the structures, calling conventions, etc
used by freepascal/Lazarus vs. Delphi?

Thanks again and best regards.
chrom


This code(-snippet) compiled with Delphi works perfect (from
www.tobybear.de (GPL))

[code]
{$J-,H+,T-P+,X+,B-,V-,O+,A+,W-,U-,R-,I-,Q-,D-,L-,Y-,C-}
library VstPlugin;
uses
  uPlugin in 'uPlugin.pas',
  uEditor in 'uEditor.pas' {PluginEditorWindow},
  DAEffect;
var Effect : APlugin;
    Oome   : Boolean;
function main(audioMaster: TAudioMasterCallbackFunc): PAEffect; cdecl;
export;
begin
 // get vst version
 if audioMaster(nil, audioMasterVersion, 0, 0, nil, 0) = 0 then
 begin
  Result := nil;
  Exit;
 end;
 Effect := APlugin.Create(audioMaster);
 if not Assigned(Effect) then
 begin
  Result := nil;
  Exit;
 end;
 if oome then
 begin
  Effect.Free;
  Result := nil;
  Exit;
 end;
 Result := Effect.Effect;
end;

exports
Main name 'main';

begin
end.
[/code]




Tony Pelton wrote:

>you are using FP or its IDE and _not_ lazarus ... right ?
>
>i had some troubles with building a DLL with lazarus, where identical
>code would build link under lazarus, and my windows application
>wouldn't load it, and everything would work fine when i built it using
>the FP compiler standalone.
>
>likely a user error, but i was never able to figure it out.
>
>my $0.02
>
>Tony
>
>On 12/29/05, chromdildo <chromdildo at t-online.de> wrote:
>  
>
>>Hallo list.
>>
>>I'm having trouble with library/DLL under Win32 (exporting one function
>>and having a little GUI).
>>Compiles fine, but the host application can't load them. The Host is
>>closed source (think MSVC).
>>
>>Same code compiles and runs fine with Delphi.
>>
>>Can someone describe the main differences with building/linking
>>libraries under Delphi/freepascal.
>>I'm sure I'm missing some compiler/linker - switch.
>>
>>Thank you very much
>>chrom
>>
>>P.S. Merry Xmas and happy new year to all.
>>    
>>
>_______________________________________________
>fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
>http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
>  
>





More information about the fpc-pascal mailing list