Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Borland has ruined my life

This topic is 6022 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am basically an expert in VB but now I started out with C++. The mistake I made was going with Borland and not Visual C++. I want to convert functions from my VB game into a dll so to speed up the game by a couple of fps. This however is quite impossible in borland. I don''t know why but I get the error "[function name] entry point not found in [dll name]" This absolutely sux as I went through everything possible (all help + forums I could find). I am using "extern "C" __declspec(dllexport)..." but this doesn''t work either. I am at the point where I destroy everything that is Borland, I will uninstall it in a couple of days unless someone can help me. here is one function float __stdcall UPDATE_X(float x, float speed, float elaps, float mov){ return (x - (speed * elaps) * mov) } I want this in a dll, which I did but it can''t be called out. If anybody can make me a basic dll where this can be called out from VB then please e-mail me at "nuke_bot_5d@yahoo.ca". Please do make sure it is in Borland, and that you include the source(I will never be able to learn if this isn''t included) Thanx, I am, 1 error/warning away from destroying everything that is borland in my house + every where else I see it.

Share this post


Link to post
Share on other sites
Advertisement
Sorry i''m just another VC user and can''t help you. However I think you shouldn''t blame Borland for your problem, since you''re obviously doing something wrong. Just take a close look at your docs, especially how to create dll''s cause that''s surely where the solution of your problem is

sorry for not helping

dmh

Share this post


Link to post
Share on other sites
I don''t know what version of C++ Builder you''re using, but this seems to think that it comes with a wizard for making dlls.

It looks to be a complete guide to getting started with a DLL (I don''t use C++ Builder, so I can''t say for sure.)


Abolish Software Patents! | freepatents | lpf

Share this post


Link to post
Share on other sites
Well, I haven''t used C++ Builder, but I have used Delphi.Go to c++ builder''s help. I am sure it has a small tutorial inside fro writing DLLs (Delphi has, so c++ builder must have it too).

If this doesn''t help, then i am sure that your problem is in the calling convention of the function you have written. Again, go to c++ builder''s help and check all the function calling conventions available there. Compare them with the calling convention of VB functions and choose the correct calling convention for your functions in C++ Builder.

Share this post


Link to post
Share on other sites
I have a full book on C++ (it came with Borland) called C++ in 21 days. I have gone through that book, the C++ help files, internet forums and everything else I can think off. Now it is time to burn the Borland CD.

Share this post


Link to post
Share on other sites
I don''t know anything about Borland C, but I got your function working in a Visual C++ DLL project:

In .C file:

float __declspec(dllexport) __stdcall UPDATE_X(float x, float speed, float elaps, float mov)
{
return (x - (speed * elaps) * mov);
}

In VB file:

Declare Function UPDATE_X Lib "testdllname.dll" Alias "_UPDATE_X@16" (ByVal x As Single, ByVal speed As Single, ByVal elaps As Single, ByVal mov As Single) As Single

...

Debug.Print UPDATE_X(20.5, 10.3, 3.5, 2.5)


The important thing is to work out what the function name will end up as in the DLL for your VB Declare statement, for more information on this do a google search for: DLL Name mangling C VB.

The name mangling that takes place on your function is:
1. prefixed with _
2. suffixed with @
3. further suffixed with the total number of bytes of the sizeofs the function parameters (i.e. 4 floats = 4 x 4bytes = 16)

Saying that, for your simple function I wouldn''t expect a big performance gain over VB, it may even be slower due to DLL calling overhead.


Share this post


Link to post
Share on other sites
OK, I''ve sent you a mail with an Visual C++ example in which I''ve put your function in a C file.

If you''re still having problems it may be because you are using a C++ file rather than C file, which has different name mangling, or some other Borland related DLL making issue, in which case I would recommend finding and checking out the Borland newsgroups.

Share this post


Link to post
Share on other sites
Making a dll in C++ that can be used in VB can be somewhat involved.

First make a dll in BCB that can be used with BCB. Once you know how to do that, add the additional issue of linking to it with VB.

Magmai Kai Holmlor
- Not For Rent

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!