xsharp.eu • VO-DLL as DLL for programma in another language
Page 1 of 1

VO-DLL as DLL for programma in another language

Posted: Thu Jun 06, 2024 2:22 pm
by dirk@triviant.be
Hi all,

I have to write a DLL which will be used as DLL for a program written in another win32-language (no dotNet).
This VO-DLL has to read/write to DBF-files, so VO is good in it.

So, the problem is the following:

Program 1 = Prog1 = Maybe written in another language, but problem also exist if this program is written in VO.
DLL1 = MyTestDLL.DLL = This DLL will be dynamic loaded with the function LoadLibrary()
DLL2 = MyBasicDLL.DLL = This DLL is hardcoded with DLL1

Inside DLL2, there is een method called CenterWindow() class Window.
There exist also a Window with the name Splash, and there is a call to oSplash:CenterWindow{} just before the super:Show().
This DLL compiles fine.

In DLL1, the program create an object oSplash := Splash{}. When calling the Show() method, the program crashes with the error "No exported method" CenterWindow.

When DLL1 is hardcoded linked on my testprogram, than everything goes fine.

Attached are all files.

Is there someone who can help me?

Thanks, Dirk

Re: VO-DLL as DLL for programma in another language

Posted: Thu Jun 06, 2024 3:59 pm
by wriedmann
Hi Dirk,
the best way would be to write a COM DLL that can be used with most different programming environments.
Wolfgang

Re: VO-DLL as DLL for programma in another language

Posted: Thu Jun 06, 2024 4:31 pm
by dirk@triviant.be
Hi Wolfgang,

Is there somewhere an example how I have to write a COMM DLL?

Dikr

Re: VO-DLL as DLL for programma in another language

Posted: Thu Jun 06, 2024 4:35 pm
by dirk@triviant.be
Hi All,

I know you have to call __VODLLClassInit() after the loadlibrary() but still not working.

Is there someone else with a lot of experience ?

Cheers, Dirk

Re: VO-DLL as DLL for programma in another language

Posted: Thu Jun 06, 2024 4:46 pm
by dirk@triviant.be
Hi Wolfgang,

The real problem is NOT the communication between the DLL and the EXE.

The real problem is that methods of a class are not visible for child-classes.
For exemple

method Center() class Window
//do something
return nil

Class Splash inherit Window
method Show() class Splash
self:Center() --------------------------> CRASH !!! (no exported method!)
super:Show()
return nil

So, this his nothing to do with COM.
See my attachments for a very small (10 lines) application !!!

(I still hope you can help me)

Cheers, Dirk

Re: VO-DLL as DLL for programma in another language

Posted: Thu Jun 06, 2024 5:30 pm
by wriedmann
Hi Dirk,
unfortunately I do not know how to write a X# DLL to be used by a non .NET application - only Robert can help you here, I think.
But I think the problem with the subclass cannot be solved as it may be a limitation of the DLL interface. Again, only Robert can help you here.

For a sample how to write a COM DLL, please see here:
https://docs.xsharp.it/doku.php?id=com_module_sample
https://docs.xsharp.it/doku.php?id=com_module_sample_vs

But I do not know if there the use of a method in a subclass works, because I do not think the COM interface cannot define class relations (and inheritance), and therefore there is no possibility to tell the interface to call the method of the father class.

Unfortunately, I would see only one possibility: define a generic "send" method in your interface that in fact uses Reflection to call the desired method.

But maybe Robert has a better idea.

Wolfgang

Re: VO-DLL as DLL for programma in another language

Posted: Fri Jun 07, 2024 8:51 am
by dirk@triviant.be
Hello Wolfgang,

Indeed. I hope that Robert will look to this problem.

(PS: I'm not writing a X#-DLL, but a VO-DLL !)

Kind regards, Dirk

Re: VO-DLL as DLL for programma in another language

Posted: Fri Jun 07, 2024 9:07 am
by robert
Dirk,
Can you send me an example of what you're trying to do?
It sounds like the GUI classes are not correctly initialized.

Robert

Re: VO-DLL as DLL for programma in another language

Posted: Fri Jun 07, 2024 9:32 am
by dirk@triviant.be
Hi Robert,

I have send it to your e-mail.

Dirk