How can I develop a DLL IN Xbase++ to use it in a C# program

This forum is for eXpress++ general support.
Message
Author
Diego Euri Almanzar
Posts: 167
Joined: Thu Nov 05, 2020 10:51 am
Location: DOMINICAN REPUBLIC

How can I develop a DLL IN Xbase++ to use it in a C# program

#1 Post by Diego Euri Almanzar »

Hello, I hope you are very well

As Xbase++ is a very versatile and modern language, I understand that there must be a way to develop a DLL library, and that it can be used externally in any other programming language.
So far, I've only tried with C#, and it hasn't been possible.

C# has many different instructions or commands to operate with external libraries. However, after three months of trying, 97% of those commands tell me that the DLL developed in Xbase++ is not formal, that it does not have a manifest.

In a Microsoft document I found the following: “All assemblies, whether static or dynamic, contain a collection of data that describes how the elements of the assembly relate to each other. The manifest contains this assembly metadata. An assembly manifest contains all the metadata necessary to specify the version requirements and security identity of the assembly, and all the metadata necessary to define the scope of the assembly and resolve references to resources and classes. The assembly manifest can be stored in a PE file (.exe or .dll) with Microsoft Intermediate Language (MSIL) code or in a separate PE file that contains only the information about the assembly manifest".

Distinguished gentlemen: has any of you had experience developing DLLs in Xbase++ to be used externally?

I will appreciate the help.

User avatar
Tom
Posts: 1171
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: How can I develop a DLL IN Xbase++ to use it in a C# program

#2 Post by Tom »

Hi, Diego.
Hello, I hope you are very well
Everything is fine here, apart from the fact that there is war in Ukraine and the Middle East and that parts of Africa are currently completely going down the drain. :(

Alaska established it's very own calling convention for functions embedded in DLLs ("DLL_XPPCALL"), which are only support by Xbase++-programs calling those functions. IMHO, you can't use a Xbase++-DLL from somewhere else. Besides, you would need all Xbase++-runtime-DLLs with your DLL. So, DLLs created with Xbase++ can only be used by Xbase++-programs.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

k-insis
Posts: 100
Joined: Fri Jan 28, 2011 4:07 am

Re: How can I develop a DLL IN Xbase++ to use it in a C# program

#3 Post by k-insis »

Indeed it is a no go with xpp and .net . As Mr. Tom wrote.

But! building own http REST server in xpp is a valid option as there is at least two toolsets available for that, once in xbase 2.x native and once as Xb2net library. And Mr. Slavoljub toolset might contain everything needed too?

So you could access xpp functionality from c# with restful api calls. Perhaps achieve read&write operations on dbf/ntx/cdx sets and such.


GG

Diego Euri Almanzar wrote: Tue Apr 16, 2024 9:06 pm Hello, I hope you are very well

As Xbase++ is a very versatile and modern language, I understand that there must be a way to develop a DLL library, and that it can be used externally in any other programming language.
So far, I've only tried with C#, and it hasn't been possible.

C# has many different instructions or commands to operate with external libraries. However, after three months of trying, 97% of those commands tell me that the DLL developed in Xbase++ is not formal, that it does not have a manifest.

In a Microsoft document I found the following: “All assemblies, whether static or dynamic, contain a collection of data that describes how the elements of the assembly relate to each other. The manifest contains this assembly metadata. An assembly manifest contains all the metadata necessary to specify the version requirements and security identity of the assembly, and all the metadata necessary to define the scope of the assembly and resolve references to resources and classes. The assembly manifest can be stored in a PE file (.exe or .dll) with Microsoft Intermediate Language (MSIL) code or in a separate PE file that contains only the information about the assembly manifest".

Distinguished gentlemen: has any of you had experience developing DLLs in Xbase++ to be used externally?

I will appreciate the help.

Diego Euri Almanzar
Posts: 167
Joined: Thu Nov 05, 2020 10:51 am
Location: DOMINICAN REPUBLIC

Re: How can I develop a DLL IN Xbase++ to use it in a C# program

#4 Post by Diego Euri Almanzar »

Hello Tom

I'm glad you're well. What is happening in the world is very discouraging. It is as if intelligence does not exist in human brains. God protect us.

It's unfortunate that Xbase++ has such a closed technology.

Thanks for your help.

Diego Euri Almanzar
Posts: 167
Joined: Thu Nov 05, 2020 10:51 am
Location: DOMINICAN REPUBLIC

Re: How can I develop a DLL IN Xbase++ to use it in a C# program

#5 Post by Diego Euri Almanzar »

Hello K-Insis

Your idea is very interesting. I need to develop a DLL with Xbase++ code. But, since that DLL will have functions that are within others developed by Alaska, I think it will not be possible.
As for the HTTP Rest Server developed in Xbase++, it sounds wonderful. If you can send me an example of how to develop an HTTP Rest Server, I will greatly appreciate it.

I have version 2.0 of Alaska Xbase++. I was looking for how to develop an HTTP Server, and set it up in Windows IIS, for more than a year. I never found a way.

I had to develop the API in another language. Although I do admit that I use Xbase++'s HTTPCLIENT to consume the API.

Again, if you have an example of an HTTP Server developed in Xbase++, I would appreciate it if you could write me at least the first 5 instructions or commands.

Thanks for your opinion.

User avatar
Tom
Posts: 1171
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: How can I develop a DLL IN Xbase++ to use it in a C# program

#6 Post by Tom »

God protect us.
If God exists and is the cause of everything, then that would be like asking him to protect ourselves from himself.
But I don't think we should have this discussion here. 8-)
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
Auge_Ohr
Posts: 1407
Joined: Wed Feb 24, 2010 3:44 pm

Re: How can I develop a DLL IN Xbase++ to use it in a C# program

#7 Post by Auge_Ohr »

hi,
that is the Problem of a Closed Environment like Xbase++ that you are depending on Alaska what they do
you need to change to Open World and use BCC or MSVC Compiler to get into C World and use 64 Bit Environment
greetings by OHR
Jimmy

User avatar
SlavkoDam
Posts: 86
Joined: Wed Apr 27, 2022 10:12 am
Location: Negotin, Serbia
Contact:

Re: How can I develop a DLL IN Xbase++ to use it in a C# program

#8 Post by SlavkoDam »

Hi Diego,

You don't need IIS to create and use HTTP Server. You can create standalone HTTP server in Xbase++ in 3 ways.

1. Use HttpEndpoint() class() to create HTTP server, and WebHandler() class to serve REST requests. You have examples how to do this in the documentation of these classes.

2. Use SocketCreate() and SocketListen() functions. You have an example in Alaska sample "source\samples\apps\httpservice", how to do this. In this example, HTTP server works as a Service application created with ServiceApp() class and started with ServiceController() class.

3. Use HttpSrv() function from PowerNet library which you already have.

Slavko
Best regards,

Slavoljub Damnjanovic
SD-SoftDesign, Alaska Software Technology Partner
https://www.sd-softdesign.com
https://www.sd-softdesign.rs

Diego Euri Almanzar
Posts: 167
Joined: Thu Nov 05, 2020 10:51 am
Location: DOMINICAN REPUBLIC

Re: How can I develop a DLL IN Xbase++ to use it in a C# program

#9 Post by Diego Euri Almanzar »

Auge_ohr, totally agree.

SlavkoDam: I was watching the programs you indicated to me. It's super interesting, I really appreciate the help. Thanks to the help of all of you, I am now aware that the only way to interact with Alaska Xbase++ DLL libraries is through a REST API.

Although, when studying the indicated source programs, I still do not understand why two executables are formed: HTTPSERVICE.EXE and HTTPCTR.EXE

I still don't understand what the relationship is between the two, nor do I understand how to form the endpoint URLs, or the controls, that a REST API should have. Since, obviously, access to a REST API is through a URL.

Of course, the idea is great, I just have to continue studying the case, or continue looking for a more illustrative example than Alaska Xbase++.

Finally, you would also have to learn how to publish the REST API. It would be necessary to investigate whether it is through IIS, or as a service installed on the computer.

Best regards.

User avatar
SlavkoDam
Posts: 86
Joined: Wed Apr 27, 2022 10:12 am
Location: Negotin, Serbia
Contact:

Re: How can I develop a DLL IN Xbase++ to use it in a C# program

#10 Post by SlavkoDam »

HTTPCTR.EXE starts Service app whose executable that it implements is HTTPSERVICE.EXE. So, you have to call only HTTPCTR.EXE with install option, and it will start HTTPSERVICE.EXE internally.

Endpoint URLs or controls that HTTP server will handle, have to be created in HttpJob() class in httpjob.prg, and its methods :getHttpRequest() and :getHttpResponse().

This example is pretty complicated and hard to follow, and it uses Service app which uses Http server, so two EXE files in two steps. It is much simpler and faster to use HttpSrv() from PowerNet library. Just call HttpSrv() to create Http server, and create endpoint URLs as usual functions in your app.
Best regards,

Slavoljub Damnjanovic
SD-SoftDesign, Alaska Software Technology Partner
https://www.sd-softdesign.com
https://www.sd-softdesign.rs

Post Reply