shadowrecon Posted April 2, 2012 Share Posted April 2, 2012 I can not get scar to recognize my exported types.. Ive tried a ton of different ways. Heres what i have [scar] Type TGMRLColor = Record ColorCount : Integer; ColorData : Array of Array of Integer; end; ......... .... ... function GetTypeCount(): Integer; stdcall; export; begin Result := 1; end; function GetTypeInfo(x: Integer; var sType, sTypeDef: string): Integer; stdcall; begin case x of 0: begin sType := 'TGMRLColor'; sTypeDef := 'record ColorCount : Integer; ColorData : Array of Array of Integer; End;'; end; else x := -1; end; Result := x; end; exports GetTypeCount; exports GetTypeInfo; exports GetFunctionCount; exports GetFunctionInfo; [/scar] Quote Link to comment Share on other sites More sharing options...
FHannes Posted April 2, 2012 Share Posted April 2, 2012 (edited) There appears to be a bug in the plugin system related to type exports, I've uploaded a fix to the prerelease repository, it will be included in 3.32.02 as well. Do note that function GetTypeInfo(x: Integer; var sType, sTypeDef: string): Integer; stdcall; should be function GetTypeInfo(x: Integer; var sType, sTypeDef: AnsiString): Integer; stdcall; As Delphi 2009 and newer use Unicode. If you're working with a version older than Delphi 2009, you should upgrade. EDIT: You should also use SCAR defined types. Add this to the type section of your library: [scar]TIntArray = array of Integer; T2DIntArray = array of TIntArray;[/scar] Replace "Array of Array of Integer" with "T2DIntArray" everywhere. Since "T2DIntArray" is already defined in SCAR, you don't need to export it. Also make sure that you use an updated copy of FastShareMem for Delphi 2009+: http://svn.scar-divi.com/scar_shellutils/FastShareMem.pas Edited April 2, 2012 by Freddy Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted April 3, 2012 Author Share Posted April 3, 2012 (edited) Alright I didn't know if I made types within my plugin the same as scar's types if I hadto export them or not. I was using t2dintarray but I didn't know why scar wasn't recognizing it. ---------- Post added 04-03-2012 at 06:05 AM ---------- Previous post was 04-02-2012 at 10:08 PM ---------- Since ive updated Delphi to 2009, and fastsharemem , i can not get scar to recognize any functions. The dll compiles fine. Im doing everything the same way i did in 2007. I deleted all references to the old fastsharemem .pas files and .dcu files. just to make sure it wasnt linking them instead. I also tried to use the old fastsharemem with 2009 but it gives a bunch of warnings when compiling so i know im not using the old fastsharemem. Im at a dead end.. Ive spent 6 hours messing with this.. i guess ill look at it tomorrow im tired.. anyone have any ideas on what could be the problem? Edited April 3, 2012 by shadowrecon Quote Link to comment Share on other sites More sharing options...
FHannes Posted April 3, 2012 Share Posted April 3, 2012 Everywhere you use "string", replace it with "AnsiString". Do the same for "PChar" and "PAnsiChar". Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted April 3, 2012 Author Share Posted April 3, 2012 (edited) Everywhere you use "string", replace it with "AnsiString". Do the same for "PChar" and "PAnsiChar". Yep thats the problem, because the "PChar" .. Thanks, wish i would of known that last night would of saved me 6 hours of time. err! Your the man Freddy. Edited April 3, 2012 by shadowrecon Quote Link to comment Share on other sites More sharing options...
FHannes Posted April 3, 2012 Share Posted April 3, 2012 As I said before, you can use this as an example: http://svn.scar-divi.com/scar_shellutils/ Don't rely on outdated tutorials. Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted April 3, 2012 Author Share Posted April 3, 2012 As I said before, you can use this as an example: http://svn.scar-divi.com/scar_shellutils/Don't rely on outdated tutorials. Yeah i rember you posting something about that a while back i really didnt understand the process then, im understanding it more and more now. Maybe when im done ill make a Tut so people dont waste there time doing the same mistakes ive done throughout this process. Quote Link to comment Share on other sites More sharing options...
FHannes Posted April 4, 2012 Share Posted April 4, 2012 SCAR Divi 3.33 will come with a new library system (again), I miscalculated my future needs when I rewrote it the last time. I'll also be providing examples on how to create library. I'll still be supporting the old plugin architecture, I've even made some improvements to give it some additional power. But there will also be a new library architecture which should be better compatible with C++ among other things. Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted April 4, 2012 Author Share Posted April 4, 2012 Having the ability to use C++ to build lib will be pretty awesome. Note: I figured out why when i was using the scar type T2DIntArray i was getting an access violation, I was trying to use it as a dynamic array and i needed tomake it a static array and set the length of both arrays! =) Quote Link to comment Share on other sites More sharing options...
FHannes Posted April 4, 2012 Share Posted April 4, 2012 Having the ability to use C++ to build lib will be pretty awesome. Note: I figured out why when i was using the scar type T2DIntArray i was getting an access violation, I was trying to use it as a dynamic array and i needed tomake it a static array and set the length of both arrays! =) I can make C++ easier, but you'd still be able to do more with Delphi. ... T2DIntArray is dynamic Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted April 4, 2012 Author Share Posted April 4, 2012 I can make C++ easier, but you'd still be able to do more with Delphi. ... T2DIntArray is dynamic The Delphi plugin system is pretty easy it's just difficult when you have no clue what scar is looking for. But I think ive got it down. yeah, I don't know what I was thinking, I should of said my problem was because I wasn't setting array lengths. Quote Link to comment Share on other sites More sharing options...
FHannes Posted April 4, 2012 Share Posted April 4, 2012 Make sure you've got the latest 3.33 Beta. And try this: http://svn.scar-divi.com/samples/ Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted April 4, 2012 Author Share Posted April 4, 2012 Will do, I'm at school ATM, but when I'm home I'll give it a go. Quote Link to comment Share on other sites More sharing options...