Page 1 of 1

How to assign GUID to Info->PluginMenu.Guids

Posted: Wed 21 Oct, 2015 16:29
by jonib
Working with the HelloWorld plugin as basis still

in the function:

Code: Select all

void WINAPI GetPluginInfoW(struct PluginInfo *Info)
I'm trying to assing a GUID to:

Code: Select all

Info->PluginMenu.Guids
Problem is I can't figure out anything that works.

I declare a new GUID like this:

Code: Select all

GUID MenuId;
And add in the correct values, but can't figure out what to do? I replaced MenuGuid from the code:

Code: Select all

Info->PluginMenu.Guids=&MenuId;
But I don't get the correct GUID showing in FAR plugins info.

Should I post these kinds of questions in separate topics or in my main plugin topic?

jonib

How to assign GUID to Info->PluginMenu.Guids

Posted: Wed 21 Oct, 2015 16:41
by HaRT
jonib wrote: Should I post these kinds of questions in separate topics or in my main plugin topic?
Separate, especially considering this:
jonib wrote: please no more unrelated to Python suggestions

How to assign GUID to Info->PluginMenu.Guids

Posted: Wed 21 Oct, 2015 17:13
by jonib
HaRT wrote:Separate,
OK
especially considering this:
jonib wrote: please no more unrelated to Python suggestions
As I'm doing the plugin in C++ I only meant I wasn't interested in doing plugins in other languages unless they helped me support Python. I could have probably worded it differently but frustration and having English as my third language that's what came out. :bojan:

jonib

How to assign GUID to Info->PluginMenu.Guids

Posted: Wed 21 Oct, 2015 19:18
by jonib
Checking the FAR API manual (after translation) it says "Info->PluginMenu.Guids" wants an "address of an array of GUIDs" unfortunately it didn't help me figure out how I need to define the variable. So still would like some hints.

jonib

How to assign GUID to Info->PluginMenu.Guids

Posted: Thu 22 Oct, 2015 01:30
by jonib
So finally this crisis is over. :Yahoo!:

When trying to define the GUID as an array I used this:

Code: Select all

GUID MenuId[1];
But it didn't work.

But using this below:

Code: Select all

GUID *MenuId = new GUID[1];
This works. I assumed they would have more or less the same effect but what do I know.

I'm convinced that the designer of C/C++ is a sadist. Designed to make me waste time on stooped stuff. :evil:

jonib

How to assign GUID to Info->PluginMenu.Guids

Posted: Thu 22 Oct, 2015 07:02
by DrKnS
jonib wrote:When trying to define the GUID as an array I used this:

Code: Select all

GUID MenuId[1];
But it didn't work.
Sure it didn't, if you returned address of a local variable.
As mentioned in PluginMenuItem description, all pointers passed through this structure must be valid after returning from GetPluginInfoW, so you can't use local variables. Use static or global ones.
But using this below:

Code: Select all

GUID *MenuId = new GUID[1];
This works. I assumed they would have more or less the same effect but what do I know.
Now you have a memory leak.

HelloWorld plugin has a working example of how to do it. MenuGuid is a global variable defined in a separate header, guid.hpp, all you had to do is replace numbers there.

[Solved]How to assign GUID to Info->PluginMenu.Guids

Posted: Thu 22 Oct, 2015 14:39
by jonib
DrKnS wrote:Sure it didn't, if you returned address of a local variable.
As mentioned in PluginMenuItem description, all pointers passed through this structure must be valid after returning from GetPluginInfoW, so you can't use local variables. Use static or global ones.
I think I'm starting to understand, thanks.
Now you have a memory leak.
But it works, trallalalla :oops:
HelloWorld plugin has a working example of how to do it. MenuGuid is a global variable defined in a separate header, guid.hpp, all you had to do is replace numbers there.
As I'm defining the GUID in Python, and sending it via a function to C++ I can't change and use the defined MenuGuid, right?

So would this work then?

Code: Select all

static GUID *MenuId = new GUID[1];
Or would that be too optimistic?

Code: Select all

linking final.32W.gcc/PythonFAR.dll
d:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../..\libmingw32.a(tlsthrd.o):(.text+0x10): undefined reference to `EnterCriticalSection@4'
d:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../..\libmingw32.a(tlsthrd.o):(.text+0x54): undefined reference to `LeaveCriticalSection@4'
d:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../..\libmingw32.a(tlsthrd.o):(.text+0xbd): undefined reference to `EnterCriticalSection@4'
d:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../..\libmingw32.a(tlsthrd.o):(.text+0xda): undefined reference to `LeaveCriticalSection@4'
d:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../..\libmingw32.a(tlsthrd.o):(.text+0x128): undefined reference to `EnterCriticalSection@4'
d:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../..\libmingw32.a(tlsthrd.o):(.text+0x158): undefined reference to `LeaveCriticalSection@4'
d:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../..\libmingw32.a(tlsthrd.o):(.text+0x17c): undefined reference to `LeaveCriticalSection@4'
d:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../..\libmingw32.a(tlsthrd.o):(.text+0x1ea): undefined reference to `DeleteCriticalSection@4'
d:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../..\libmingw32.a(tlsthrd.o):(.text+0x218): undefined reference to `InitializeCriticalSection@4'
ertr000001.o:(.rdata+0x0): undefined reference to `_pei386_runtime_relocator'
collect2.exe: error: ld returned 1 exit status
../makefile_gcc_target_inc:35: recipe for target 'final.32W.gcc/PythonFAR.dll' failed
mingw32-make.EXE: *** [final.32W.gcc/PythonFAR.dll] Error 1
So that didn't work too well. :o

So how do I declare a variable that is acceptable? I don't want to waste another day trying to figure this out.

jonib

[Solved]How to assign GUID to Info->PluginMenu.Guids

Posted: Thu 22 Oct, 2015 14:56
by 2useven10
jonib wrote:I don't want to waste another day trying to figure this out.
All your project is wasting time. If you will not try to figure out what you do.

[Solved]How to assign GUID to Info->PluginMenu.Guids

Posted: Thu 22 Oct, 2015 15:27
by jonib
2useven10 wrote:All your project is wasting time. If you will not try to figure out what you do.
What?!, is this supposed to be some kind of encouragement. Where did I write that I wouldn't try to figure out what to do? I'm just trying to minimize wasting of limited resourses (My patience, motivation and my sanity)

jonib

How to assign GUID to Info->PluginMenu.Guids

Posted: Fri 23 Oct, 2015 10:34
by 2useven10
jonib wrote: So I am tired to wait for someone to add Python support for Far manager, so I'll try myself.

I did some basic courses in C/C++ about 20 years ago and I really never liked to code in it. So I'm rusty/have no idea what I'm doing.
Do not waste your time. You have not enough skills for that task.